.htaccess stupid issue

Posted by justnoone on Stack Overflow See other posts from Stack Overflow or by justnoone
Published on 2010-04-07T19:33:20Z Indexed on 2010/05/13 15:04 UTC
Read the original article Hit count: 200

Filed under:
|
|

I have a server where I can only configure httpd using .htaccess, a cannot access global configuration. I want to rewrite almost every non-existing path to index.php, so I did something like:

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

And that is ok. But another thing I want to do is to prevent access to path where I keep PHP files (I cannot store them somewhere else) which is for example /php. I would like that anything starting with /php rewrites to index.php?path=php... so I did something like:

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

And that also would work ok if I had access to global configuration. In case of per-directory configuration, when I access /php it rewrites it to index.php?path=php and than puts directory name before that: /php/index.php?path=php. I read documentation and I realize that it uses internal redirects when per-directory confoguration is used. How can I avoid this behavior?

© Stack Overflow or respective owner

Related posts about httpd

Related posts about .htaccess