Reputation: 9
I have a website and need everything in my subdomain to redirect to my home page.
For example I would need www.website.com/sub
to redirect back to www.website.com
same with anything else within /sub
so www.website.com/sub/sdjdj/sdsd/dsd ....
would also need to redirect to www.website.com
How can I achieve this with htaccess?
Upvotes: 0
Views: 29
Reputation: 24448
You can use this in your .htaccess in the root.
RewriteEngine On
RewriteRule ^sub(?:$|/.*) / [R=302,L]
When you are sure the rule is working as intended, change to 301
in rule.
Upvotes: 1