Mobile app version of vmapp.org
Login or Join
Phylliss660

: .htaccess 301 Redirect for wildcard subdomains I run WordPress in Network mode, which means I can have multiple websites running off one installation of WordPress. Each website runs as a subdomain.

@Phylliss660

Posted in: #301Redirect #Htaccess #MultiSubdomains #Subdomain #Wordpress

I run WordPress in Network mode, which means I can have multiple websites running off one installation of WordPress. Each website runs as a subdomain. WordPress handles this using .htaccess, and a wildcard subdomain pointing to the location of WordPress, so there are no actual subdomains created in cPanel; just a wildcard subdomain in cPanel, ad WordPress handles the rest.

I want to 301 redirect one.example.com/portfolio to two.example.com/portfolio.
If I only have 1 .htaccess file in the web root of example.com, how do I achieve this?

EDIT: I have used the following but it does not work:

RewriteCond %{HTTP_HOST} ^steve.doig.com.au$ [NC]
RewriteRule ^/products.html tech.doig.com.au/products.html/ [L,R=301]


(this is to redirect steve.doig.com.au/products.html to tech.doig.com.au/products.html)

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Phylliss660

1 Comments

Sorted by latest first Latest Oldest Best

 

@Bryan171

If I am not mistaken, you should be able to do something like this:

RewriteCond %{HTTP_HOST} ^one.example.com$ [NC]
RewriteRule ^portfolio$ two.example.com/portfolio [L,R=301]


This is from memory, but maybe you get the idea (HTTP_HOST).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme