Forum Moderators: phranque
# Redirect to dir
RewriteCond %{REQUEST_URI} index.php
RewriteRule .* /dir/index.php [R] But this freezes the browser and I get an error that the number of redirects have been exceeded. Interestingly, if I do this:
# Redirect to dir
RewriteCond %{REQUEST_URI} index.php
RewriteRule .* /dir/test.php [R] then all works to perfection. Is there a way that I would be able to accomplish what I am trying to do...?
Sincere thanks,
Joe Belmaati
Copenhagen Denmark
PS. Did a board search but I could not find the information.
Do you really want a redirect and not an internal rewrite? That is, do you want the new URL to show up in search engine results and the visitor's browser address bar?
The code problem is easy to fix, but you need to decide about the redirect versus rewrite, and what you're really trying to accomplish.
RewriteCond $1!dir/index\.php$
RewriteRule (.*) /dir/index.php [R,L]
RewriteRule ^index\.php$ /dir/index.php [R,L]
Look for any other redirects that may conflict with this one, or settings in your /dir subdirectory such as RewriteOptions inherit that may cause a loop.
Jim