Reputation: 65
I wrote this redirect rules for my primary domain:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^projetomedicina\.com\.br$ [OR]
RewriteCond %{HTTP_HOST} ^www\.projetomedicina\.com\.br$
RewriteCond %{REQUEST_URI} ^/site[/]?$
RewriteCond %{HTTP_HOST} !^(lojinha_\.projetomedicina\.com\.br$ [NC]
RedirectMatch 301 ^/$ /portal
RedirectMatch 301 ^/site/$ http://projetomedicina.com.br/portal
But then I try to access one of my subdomains: http://lojinha.projetomedicina.com.br it redirects to /portal.
How can I modify my .htaccess in order to do not allow redirects from my subdomain?
Upvotes: 4
Views: 70
Reputation: 784888
RedirectMatch
is directive from mod_alias
. What you need is RewriteRule
here:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?projetomedicina\.com\.br$ [NC]
RewriteRule ^(site)?/?$ /portal [L,R=302,NC]
Make sure to clear your browser cache before testing this change.
Upvotes: 4