Any special considerations for redirecting to subdomain?

Asked by:
HubFans / n/a Points
Time:
2016-01-11 10:00 pm EST
Category:
Htaccess
Hits:
76
This is in theory only right now. But I was wondering how to write a 301 redirect from the primary domain's url to the subdomain's url. Basically, I want all pages of the primary to forward to the subdomain's home page. Ideally, I might like to pick a few to go to particular pages in the subdomain. I am worried about getting in a redirect loop since this involves a subdomain. Thanks!

To ask this user for more information, please first login.

To submit an answer, please login.

ANSWERS

0

ScottM
Staff
16,266 Points
2016-01-11 10:04 pm EST
Hello,

Thank you for your question on 301 redirects.

To redirect all URLs of one domain to a specific page in teh subdomain (main page, for example) you will need to set it up like below:

RedirectMatch 301 ^/(.*)$ http://newsite.com/index.html

For each exceptional page, you will need to craft each one individually. They should appear in the format as below:

RedirectMatch 301 /contact.php /contact-us.php [L]

When placing them in the .htaccess file, be sure to put these above the full domain redirect so that they will activate first. Then, if they are not triggered, the main redirect will take place.

Kindest Regards,
Scott M

To submit a comment on this answer, please first login.

Want to share this Question?

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!
Need More Help?

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.
}