How do you redirect pages from a subdirectory up one level to the root directory
Posted
by kezzman11
on Server Fault
See other posts from Server Fault
or by kezzman11
Published on 2010-05-19T23:07:37Z
Indexed on
2010/05/19
23:10 UTC
Read the original article
Hit count: 170
I have recently moved all the content on my website from being in the www.mysite.com/shop directory to being in the root directory. This means that now I need to redirect any request to visit a page with the /shop directory back to the same page in the root directory eg.
www.mysite.com/shop/categories/washroom
to
www.mysite.com/categories/washroom
This needs to happen with all pages in my site that were previously using the /shop directory.
The closest thing to a solution that I have found so far is the following code
RedirectMatch ^/shop/.* http://www.mysite.com/
however this redirects all pages back to the homepage instead of to the relevant matching page without the /shop.
Can someone please point me in the right direction, or if this has already been answered in here can you please post the link to the answer.
© Server Fault or respective owner