Forum Moderators: phranque
This decision should be made based on usability -- Don't confuse the visitor or the search engines!
Jim
%{SERVER_NAME}
...is an Apache variable because if I remove the % it redirects to http://www.{server_name}.com/.
I think the closest I've gotten is with the following...
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/RewriteRule ^index\.php$ [%{SERVER_NAME}...] [R=301,L]
I'm missing something and I've tried a few things (in no particular order)...
1.) %{REQUEST_URI} however this doesn't do anything however it also does not loop...so perhaps it redirects once...or it doesn't redirect at all? Hm...
2.) I've seen $1 used a lot in posts though it doesn't seem to do much. I'm not seeing it in Apache's documentation (not exactly search friendly ha!)
I've tried various combinations though I end up with funny addresses. I'm not sure if I've mentioned that I'm trying to do this for all sub-directories too? What else can I try to mess with?
- John
Also see the resources cited in our forum charter.
This rule requires a non-blank HTTP_HOST:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
RewriteCond %{HTTP_HOST} ^(.+)$
RewriteRule ^index\.php$ http://%1/ [R=301,L]
[edited by: jdMorgan at 8:19 pm (utc) on Feb. 24, 2009]