I have a domain that contains a shop installed in the root and WordPress in a subfolder called /web/
/public_html/ # shop
/web/ # wordpress
I am in the process of moving the shop to a new domain. WordPress is remaining put.
I wish to 301 redirect all shop pages but exclude WordPress requests. This part works.
# Redirect shop to new domain
RewriteEngine on
RewriteCond %{REQUEST_URI} !^web($|/)$
RewriteRule (.*) http://www.new-domain.co.uk/$1 [R=301,L]
The following similar threads lead me to the above solution.
- Redirect site with .htaccess but exclude one folder
- Redirect site with .htaccess but exclude two+ folders
What I want to do now is make it so that visitors coming in to the old domain are simply redirected to /web/. I've tried adding:
RewriteCond %{REQUEST_URI} !^/index\.php$
but this is not working to exclude the root index file.
I think I need another RewriteRule in there somewhere.