0

What do I place in my .htaccess file to redirect all pages related to a subdomain to it's parent domain.

So basically all pages related to

http://products.example.com redirects 

to 

http://example.com

I need ALL pages that are related to the subdomain to redirect to the root domain.

Example:

http://products.example.com/page1 http://products.example.com/anotherpage http://products.example.com/somepagename etc..

All go to http://www.example.com

  • 1
    Possible duplicate: http://stackoverflow.com/questions/13989162/htaccess-redirect-subdomain-to-external-url – node_modules Apr 12 '16 at 12:15
  • Neither of those solutions mentioned on that page work because all subdomains that have pages go to 404 pages. For instance. http://products.example.com/page1 will go to a 404 page. I'm looking to send all subdomains to the parent domain. – WordPressDeveloper Apr 12 '16 at 12:24
  • Can you post what you have tried? – Amit Verma Apr 12 '16 at 14:39
  • RewriteCond %{HTTP_HOST} ^products\.silvercross\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.products\.silvercross\.com$ RewriteRule ^/?$ "https\:\/\/www\.silvercross\.com\/" [R=301,L] ` – WordPressDeveloper Apr 12 '16 at 14:40

0 Answers0