HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (
-   Programming/Scripts (
-   -   Apache mod_rewrite - Regex explanation (

autogun 2nd June 2012 21:47

Apache mod_rewrite - Regex explanation
Hello all,

This one is killing me, I was banging my head for several hours and couldn't solve it until I got some external help.

What I was trying to achieve is - Every request that is not calling index.php, robots.txt or resources folder to be rewritten to

On a development server, this worked as expected:

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

But when I moved the code to my production server (running ISPConfig), the above didnt work because "?" had to be added:

RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

Can maybe someone explain me, why?
I was lost here :-(

falko 4th June 2012 14:06

I could imagine that it has something to do with cgi.fix_pathinfo in your php.ini. I suggest you compare the setting on both servers.

nababan 16th December 2012 23:56

check your cgi exec configuration

All times are GMT +2. The time now is 00:02.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.