.htaccess - Redirect All Subdomain URLs to Home Page -


the website in question had sub domain ecommerce platform, we've added ecommerce functionality main site, want entire shop sub domain redirect home page. i'm using following code in .htaccess file:

rewritecond %{http_host} ^shop.domain.co.za$ [nc] rewriterule ^(.*)$ http://www.domain.co.za%{request_uri} [r=301,nc,l,qsa] 

this redirects url on sub domain same url on main site, shop.domain.co.za/product redirect www.domain.co.za/product, want redirect home page, since url structure has changed.

so in other words, want url on shop.domain.co.za rediect home page, www.domain.co.za, how can done?

any appreciated.

thanks
willem

you can replace rule rule:

rewritecond %{http_host} =shop.domain.co.za rewriterule ^ http://www.domain.co.za/? [r=301,l] 

using %{request_uri} cause original uri copied in target. trailing ? in target strip off pre-existing query string.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -