tags:

views:

1436

answers:

1

I have my whole project in directory document_root and I need to redirect there.

I've made simple rewrite rule

RewriteEngine on
RewriteRule ^(.*)$ document_root/$1 [L]

which works just fine if I have

http://someurl.com/?foo=bar

but when I do

http://someurl.com/index.php?foo=bar

then it is redirected to the document_root version, so the url looks like

http://someurl.com/document_root/index.php?foo=bar

which I wanted to avoid.

Is there also any way how to block the document_root version and send it back to the shorter url version?

A: 
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !.*/index.php$
RewriteRule ^(.*)$ document_root/$1 [L]
chaos