简体   繁体   中英

CodeIgniter: rewriting URL's with .htaccess

I've build an application using CodeIgniter with several controllers

I want the application URL to look "pretty" by using .htaccess files.
All controllers seem to work just fine except for the controller that is set as default in the "application/config/routes.php" file

My .htaccess file looks like this:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

I have also set the config.php file like this

$config['index_page'] = '';

In the server logs I'm getting errors like this:

[Fri Nov 29 10:32:11 2013] [error] [client . . . ] mod_security: Filtering against POST payload requested but payload is not available [hostname "app. * .nl"] [uri "/user/profile"]

On the development server everything worked just fine, but ever since the app is on the production server it doesn't work with the .htaccess files.

AddDefaultCharset UTF-8

RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_URI} ^codeigniter.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM