Reputation: 980
I have two domains linked with my hosting, the first one is the main one that has this root: public_html
, and the second one is an Addon domain that has this root: public_html/lemerge
.
when the user enter www.main-domain.com/lemerge
he access the second website. But I want to redirect the user to the main website instead of accessing the second website. So if the user enter www.main-domain.com/lemerge
the user should be redirected to www.main-domain.com
I used redirects in cPanel to generate this code but it does not work.
RewriteCond %{HTTP_HOST} ^main-domian\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.main-domian\.com$
RewriteRule ^lemerge\/?$ "http\:\/\/main-domian\.com\/" [R=301,L]
Upvotes: 1
Views: 54
Reputation: 785581
You can use this code in your /lemerge/.htaccess
file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?main-domian\.com$ [NC]
RewriteRule ^ http://%{HTTP_HOST}/ [R=301,L]
Upvotes: 1