Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Mod_rewrite help


Mouzi's Avatar
Member
0 0

Anyone good with Apache mod_rewrite? Or do you know where I should look for help?

Anyway here's my problem:

I want to show different content if a cookie is matched so I do this:

Options +FollowSymLinks

RewriteCond %{HTTP_COOKIE} .*site=i.* [NC]```

So far so good. Everything works to this point, but the problem comes with the RewriteRule.

My webhost is structured like this:
/home/user/ and then the user's contents
I have made it so that my main domain goes to /home/user/public_html/

Also the .htaccess file I use is in /home/user/public_html/.htaccess

Now if I wanted to (internally, so that it won't change the URL) redirect all requests to /home/user/public_html/isite/, (which could be represented as mydomain.com/isite/), it will redirect indefinitely because the cookie is still there and the .htaccess checks for it. Another option would be to redirect all requests to /home/user/isite/ which would be much better, but I can't get it to work :S I have tried to modify the path with RewriteBase, which gave 500 internal server error, and with ../, which gave bad request error. Any suggestions?

EDIT: Argh, noone ever replies in my threads :P Anyway I got it working with a [NS] flag. Still can't get the second option working though :/

EDIT2: It didn't work after all...