Rewrite rule with exception

Here is my directory structure

main site:-

Read More
www.magentosite.com

WordPress site:-

www.magentosite.com/wordpresssite

And Here is my htaccess rule for redirect. If User goes to wordpress site then they will redirect to magentoSite.

RewriteCond %{REQUEST_URI} !^WordpresSITE/
RewriteRule .? http://www.MagentoSITE.com/ [L]

PROBLEM

Above should work as it is but I want to put if user goes to admin side of wordpress then yes they should not redirect. In short www.magentosite.com/wordpresssite/wp-admin/... should not redirect.

Related posts

Leave a Reply

1 comment

  1. The below code should go inside the .htaccess on the WordPress folder:

    Options +FollowSymLinks -MultiViews
    
    RewriteEngine On
    
    RewriteCond %{REQUEST_URI} !^/wordpresssite/(wp-login.php|wp-admin) [NC]
    RewriteRule ^ http://www.MagentoSITE.com/ [R=302,L]
    

    Basically what I am doing is if the URL start with:

    www.magentosite.com/wordpresssite/wp-login.php
    

    Or starts with:

    www.magentosite.com/wordpresssite/wp-admin
    

    It should not redirect, if it doesn’t then it redirects.