Forum Moderators: phranque
RewriteRule ^(.*)$ /members/index.html , it doesnt work and gives Internal server error.
What can be the possible error? I have not posted it with the other question as it looks different from the other problem.
Please help.
Thanks to everyone, Happy Xmas too
AjiNIMC
# if NOT already rewritten to /members/index.html
RewriteCond %{REQUEST_URI} !^/members/index\.html$
# rewrite all requests to /members/index.html
RewriteRule (.*) /members/index.html [L]
You should also be aware that you will rewrite robots.txt and all image, CSS, and external JS files to /members/index.html with this code, so think about what classes of files you really want to rewrite, and which you don't. Then you can write a rule-set based on whichever class is smaller or easier to define.
Jim
This is not going to infinite loop as firefox tells you if the redirection happens for more than a specified number.
I am also not using [R](redirect) so REQUEST_URI wont work as a check, I will have to check with Script_URI.
I am going to try this after christmas. A very happy Christmas to all webmastermaster members.
Special thanks to jdMorgan for the replies
Erm... Don't confuse REQUEST_URI with THE_REQUEST. REQUEST_URI works fine to stop internal rewrite looping.
> This is not going to infinite loop as firefox tells you if the redirection happens for more than a specified number.
But of course, Firefox isn't involved here, since this is an internal rewrite loop, not a redirection loop.
Check your error logs...
Jim
I had to do this,
RewriteCond %{HTTP_COOKIE} ([[:print:]])userid([[:print:]])
# if NOT already rewritten to /members/index.html
RewriteCond %{REQUEST_URI}!^/members/index\.html$
# rewrite all requests to /members/index.html
RewriteRule (.*) /members/index.html [L]
RewriteCond %{HTTP_COOKIE} ([[:print:]])userid([[:print:]])
# if it is a directory
RewriteCond %{REQUEST_FILENAME} -d
# rewrite all requests to /members/index.html
RewriteRule (.*) /members/index.html [L]
Is there a better way I can use the [OR]
Thanks
Aji
RewriteCond %{HTTP_COOKIE} ([[:print:]])userid([[:print:]])
# if NOT already rewritten to /members/index.html
RewriteCond %{REQUEST_URI}!^/members/index\.html$ [OR]
# or if request exists as a directory
RewriteCond %{REQUEST_FILENAME} -d
# rewrite all requests to /members/index.html
RewriteRule (.*) /members/index.html [L]