What are the most commonly used and basic Apache htaccess redirects?
- by bybe
This question is here so we can offer users who are looking for information on how to make one or more common or basic redirects in Apache using the htaccess file. All future questions pertaining to finding information that is that is covered by the question should be closed as a duplication of this question. As per this Meta question.
Whats the point in this question? The idea while not perfect is catch the most commonly asked questions regarding redirects using the htaccess on the Apache platform either on some type of lamp or a live server. The type of answers should be generally those that you could imagine are used by 100,000’s of sites world-wide and are constantly asked here at Pro Webmasters repeatedly over and over in various forms.
A few examples of the type of answers we are looking for:
How can I redirect non-www to www?
How can I redirect a sub domain to the main domain?
How can I redirect a sub folder from domain to a root or a subdomain?
How can I redirect an old URL to a new URL?
A few examples of the types of answers that we are not looking for:
Answers that do not involve a redirect.
Any answers relating to NGinx, IIS or any other non-Apache platform.
Answers that involve custom and complex string or query removals.
Resources for Advanced to Complex Mod_Rewrite Rules:
Everything you ever wanted to know about mod rewrite rules but were afraid to ask
Please note: that this question is still in construction and may need some refining either by myself or a real moderator of Pro Webmasters, if you have any concerns or questions please use the meta page I made a few days back here.