mod rewrite - Redirecting not working using .htaccess file from to the main domain -


i have 2 domains linked hosting, first 1 main 1 has root: public_html, , second 1 addon domain has root: public_html/lemerge.

when user enter www.main-domain.com/lemerge access second website. want redirect user main website instead of accessing second website. if user enter www.main-domain.com/lemerge user should redirected www.main-domain.com

i used redirects in cpanel generate code 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] 

you can use code in /lemerge/.htaccess file:

rewriteengine on  rewritecond %{http_host} ^(www\.)?main-domian\.com$ [nc] rewriterule ^ http://%{http_host}/ [r=301,l] 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -