Forum Moderators: phranque

Message Too Old, No Replies

Trouble getting RewriteRule to work with root directory

         

formasfunction

4:57 am on May 21, 2007 (gmt 0)

10+ Year Member



I have the following RewriteRule working within an htaccess file in the root directory of a site:

<IfModule mod_rewrite.c>
Options FollowSymLinks
RewriteEngine on
RewriteRule ^direct/(.+) /index.php?q=$1 [L]
</IfModule>

I'm trying to get it to work without the need to reference the directory "direct" on the first part of the rule and instead reference the root:


RewriteRule (.+) /index.php?q=$1 [L]

For some reason it's not working as expected.  I know that if you're referencing the folder in which htaccess resides then you don't need the leading "/" but as for what else I could have overlooked I'm not so sure.

vincevincevince

5:18 am on May 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think the problem is that index.php (to which you redirect) is being matched by the rule as well... so you redirect and to index.php which redirects to index.php etc....

You need to exclude index.php from your condition first