Redirect multiple wordpress subdomains to main domain using htaccess BUT exclude one?
-
I have recently moved a large site with multiple subs and am consolidating all content into one domain. So I HAD. siteA.domain.tld siteB.domain.tld siteC.domain.tld which I need to redirect to http://domain.com I have also added the NEW subdomain newsite.domain.tld How do I write the htaccess file to redirect all but the new subdomain to the main site?
-
Answer:
Something like this should work: RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^*\.domain\.tld RewriteCont %{HTTP_HOST} !^newsite.domain.tld RewriteRule ^(.*)$ http://domain.com/%241 [R=301,L]
Chris Wiegman at Quora Visit the source
Related Q & A:
- If you were to start using a Wordpress framework today, which one would you use?Best solution by WordPress
- How to make nginx to redirect multiple subdomains?Best solution by stackoverflow.com
- How to I redirect URLS with special characters in htaccess?Best solution by Server Fault
- How to rewrite URL using htaccess?Best solution by Stack Overflow
- How to rewrite a URL using htaccess?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.