What are the most commonly used and basic Apache htaccess redirects?

Posted by bybe on Pro Webmasters See other posts from Pro Webmasters or by bybe
Published on 2013-04-12T18:03:32Z Indexed on 2014/08/24 16:29 UTC
Read the original article Hit count: 259

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:

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.

© Pro Webmasters or respective owner

Related posts about apache

Related posts about htaccess