I'm testing my php app built with Codeigniter on local host (wamp). In Firefox all my URLs go to my default controller unless I add a trailing slash.
eg site.com/controller/method/
Even methods not expecting a third URI segment are redirected. Does anyone know the reason behind this?
Update
application/config/routes.php
$route['default_controller'] = "pages"; //loads homepage view
$route['404_override'] = '';
I'm not using .htaccess on localserver
You mentioned you are not using .htaccess but without rewriting /controller/method/
into appropriate path your application will fail. Usual .htaccess file for a CodeIgniter application should contain at least the following configuration for rewriting
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Change your URL like this. This is default URL.
site.com/index.php/controller/method/
If you are configured .htaccess
site.com/controller/method/ this url is correct
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.