How to call sitemap.xml in codeigniter application - codeigniter

i have added sitemap.xml file to my codeigniter project.
And i call it on my localhost like that : http://localhost/demo/sitemap.xml
it runs without any issue.
But when i run it on live server http://example.com/demo/sitemap.xml
it says 404 page not found.
What is issue ?

you need to add below things in your config/routes.php file
$route['sitemap\.xml'] = 'demo/sitemap'; // your navigation path i.e. your controller_name/function_name

Related

Netlify Redirect not working in my app with React Hooks

Hi i try connect my page in netlify with a service external but i dont now how configurate _redirects I put this:
/api/* http://www.webservice.com/:splat 200
And my app get webservice and put these url https://myapp.netlify.app/api/products
i want that put http://www.webservice.com/api/products
my _redirects is in public folder , my app is developer in react-hooks with webpack
plese someone cant help me,
Put the following in your netlify.toml file:
[[redirects]]
from = "/api/*"
to = "http://www.webservice.com/api/:splat"
status = 200
Then browse to https://myapp.netlify.app/api/products and it'll show you the page at http://www.webservice.com/api/products.

TYPO3 - HTTPS Migration

I'm running a website under TYPO3 6.2 and follow this tutorial in order to migrate my website on HTTPS. For now I got success with :
following typoscript configuration on the root page :
config.absRefPrefix = auto
config.baseURL >
following TSconfig on the root page :
TCAdefaults.pages.url_scheme = 2
.. and everything seem to work fine. But if I edit this parameter :
... website shuts down with infinite redirection loop (301 Moved Permanently). Why ? The result is the same (infinite loop) if I execute this query :
UPDATE pages SET url_scheme = 2
...and same for BE if I make this change :
$GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSL'] = ‘2’;
You should not use the url_scheme field exactly because of issues like these. In fact this field was dropped with TYPO3v8. Any Page TSConfig related to url_scheme should be removed and you should run an SQL query to fix all existing pages.
Instead you should enforce HTTPS using a redirect in your .htaccess.
Infinite loops like these are usually caused by redirects performed both by TYPO3 and your webserver:
You request the site with HTTP.
TYPO3 redirects to HTTPS
Your webserver redirects to HTTP
Repeat 2. and 3.
For this reason you should also check your existing redirects, e.g. for enforcing www. in your domain.

Redirecting to API/Docs/index.html folder in Lumen

So i have an API created with Lumen with some documentation done with Apidoc outside of the public folder and i'd like to serve it when the user goes to the URL http://apidomain.com/docs
This is the structure of the app
ProjectRoot
->API
->Auth
->Docs
->v1
->app
->bootstrap
->database
->public
...
Is there any way to create a route that sends the user to API/Docs?
It's done, it was actually my bad, when trying to call the file via routes it actually messed up the filepath for the other files. So when i looked in the dev tools on chrome i noticed i was getting 404's on my js and css files, hence the failure to load the ApiDoc

codeigniter base url and routes

I want to develop my codeigniter (v3) application at this address:
http://localhost/mycodeigniterApp/
I have :
$config['base_url'] = 'http://localhost/mycodeigniterApp/';
I get a 404 when I try to load any address in my applicaiton ( except for the default ).
Just closing this up the correct response was:
Couple checks make sure you class and file name of controller has
first letter upper case. Then check your routes.php

Allow URLs with Dashes on azure websites

I am trying to make an SEO friendly link for a downloads page
using codeigniter hosted on Azure Websites, now this is working:
www.example.com/downloads/viewfile/34
now when i generated this link :
www.example.com/downloads/viewfile/my-nice-file-name-34
the Url rewrite works great locally on a WAMP server, but when deployed to the remote (Azure Webites IIS ?) it gives the error:
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
I believe that the cause is: dash symbols are not allowed on IIS but is there a way arround ?
After all, i found out that its not the dash symbols that are causing the problem, but the words in the url itself
like yesterday i had www.example.com/downloads/viewfile/example-file-34
to some reason, having your domain-name in the url segments makes that error apear, so i simply replaced "mydomain" into nothing before generating the Url segment
$fileName = str_replace('mydomain','',$fileName);
return url_title($fileName.$fileId);
Now the same link above is www.example.com/downloads/viewfile/file-34 and its working fine.
i also noticed that same behavior is experienced when using some words like : ajax, json.
I hope this would be helful to somone.
In your routes.php file
Find
$route['translate_uri_dashes'] = FALSE;
Replace with
$route['translate_uri_dashes'] = TRUE;
You may need to look also into
URI Routing Codeigniter 3
http://www.codeigniter.com/user_guide/general/routing.html
Codeigniter 2 URI Routing
http://www.codeigniter.com/userguide2/general/routing.html

Resources