php - Rewrite rule with exception -


here directory structure

main site:-

www.magentosite.com 

wordpress site:-

www.magentosite.com/wordpresssite 

and here htaccess rule redirect. if user goes wordpress site redirect magentosite.

rewritecond %{request_uri} !^wordpressite/ rewriterule .? http://www.magentosite.com/ [l] 

problem

above should work want put if user goes admin side of wordpress yes should not redirect. in short www.magentosite.com/wordpresssite/wp-admin/... should not redirect.

the below code should go inside .htaccess on 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 doing if url start with:

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

or starts with:

www.magentosite.com/wordpresssite/wp-admin 

it should not redirect, if doesn't redirects.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -