we recently moved to an addon domain. I'm having problems with the redirect. I need to redirect for the following situations:
- mydomain.com/mysubfolder/ to mysubfolder.com
- mydomain.com/mysubfolder/wp-login.php? to mysubfolder.com/wp-login.php?
- mydomain.com/mysubfolder/page/ to mysubfolder.com/page/ [there are many pages]
This is my current regex:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/wp-login.php
RewriteRule ^/mysubfolder/(.*)$ http://www.mysubfolder.com/$1 [L,R=301]
It takes care of points 1 and 2. But I can't figure how to take care of point 3.
Thanks in advance.
Your regex redirects all pages except wp-login.php. It also does not account for the URL without the trailing slash. I added the ? to correct this.