Ad

Htaccess Redirect

- 1 answer

I'm having trouble with setting up an htaccess redirect.

I need to redirect the following URL:

neemoil.com.au [OR]
www.neemoil.com.au

to neemoil.com.au/shop

I also want it to redirect:

neemoil.com.au/shop/*

to neemoil.com.au/*

Can anyone help?

Ad

Answer

What you are asking will make the client loop forever.

neemoil.com.au/shop 
#would be redirected to 
neemoil.com.au/         
#which in turn would be redirected to 
neemoil.com.au/shop     
#and it would keep on looping... 
neemoil.com.au/ 
neemoil.com.au/shop

You can use htaccess redirects like this:

If it is not a filename, nor a directory and the request URI is shop OR pay OR etc... redirect it to your address...

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (shop|pay|secure|etc)
RewriteRule ^(.*)$ www.neemoil.com.au [R=301,L]
Ad
source: stackoverflow.com
Ad