Forum Moderators: phranque

Message Too Old, No Replies

Problem with .htaccess redirecting when it shouldn't

.htaccess redirecting

         

patrickmathews

3:52 pm on Feb 8, 2009 (gmt 0)

10+ Year Member



I have a website that runs three different applications in three different directories - /shop (zen cart) /sb (sort of CRM app in site builder) and /app1 (online education app).

I am having a problem now where links clicked in the /driving directory are getting the /shop directory prepending to the link - this is causing page not found errors.

Here is the .htaccess file:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/shop/
RewriteCond %{REQUEST_URI} !^/shop
RewriteCond %{REQUEST_URI} !^/sb/
RewriteCond %{REQUEST_URI} !^/sb
RewriteCond %{REQUEST_URI} !^/app1/
RewriteCond %{REQUEST_URI} !^/app1
RewriteRule (.*) [domain.com...] [r=301,nc]

I am a relative newbie at fooling with .htaccess stuff so any help would be appreciated!

Thanks
Patrick

patrickmathews

4:01 pm on Feb 8, 2009 (gmt 0)

10+ Year Member



I should add the error I'm getting:

[Sat Feb 07 17:36:35 2009] [error] [client 76.218.80.121] File does not exist: /home/safety11/public_html/shop/app1, referer: [domain.com...]

Notice how the referer does not have the /shop in the link but the page not found does.

g1smd

4:04 pm on Feb 8, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Your redirect only runs when the request does not contain 'shop' or 'sb' 'app1', therefore it does run when the request does contain anything else, including 'driving'.

It is working exactly as coded. If you need more exclusions, add more RewriteCond lines to specify them.