Jump to content

Redirect All subdomain url to specific url using .htaccess


biswarup

Recommended Posts

First you need to set-up wildcard subdomains on your DNS. Assuming this is done, something like this should work...

 

RewriteCond %{HTTP_HOST} !example.com

RewriteRule .* http://example.com/%{REQUEST_URI} [R=302]

 

Once you're happy it's working you can switch the 302 to 301.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.