Sign up ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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 to

If I only have 1 .htaccess file in the web root of, 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 [L,R=301]

(this is to redirect to

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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

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

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

share|improve this answer
What about redirect, rather than rewrite? – Steve Sep 2 '12 at 3:21
See my edit to the original question please Leif. – Steve Sep 2 '12 at 3:57
Okay, I had the time to try it myself. There is slash too much in RewriteRule. Try: RewriteRule ^portfolio$ [L,R=301] (I updated my answer accordingly) – Leif Sep 3 '12 at 8:19
Good on you! You've nailed it. Thanks for your help. – Steve Sep 4 '12 at 9:10
You cannot, but there seem to be some workarounds, like this one:… Also try searching for "one rewritecond multiple rewriterule". – Leif Sep 5 '12 at 14:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.