www.question-defense.com | Engage: Visit :: Login :: Register
Translate to English Übersetzen Sie zum Deutsch/German Переведите к русскому/Russian Μεταφράστε στα ελληνικά/Greek Vertaal aan het Nederlands/Dutch ترجمة الى العربية/Arabic 中文翻译/Chinese Traditional 中文翻译/Chinese Simplified 한국어에게 번역하십시오/Korean 日本語に翻訳しなさい /Japanese Traduza ao Português/Portuguese Traduca ad Italiano/Italian Traduisez au Français/French Traduzca al Español/Spanish
1

Tonight we are launching a new portiong of Question-Defense.com called Engage. This new section allows anyone to write questions and allows the community to respond to those questions. Now people can become more involved and more questions will be answered because the possibilities of who can respond are endless.

During this launch we are removing the QD Forums since they were never used much anyway. The new Engage format allows the community to interact in a much easier way. So since the forums did have some content and the search engines had the links to that content in their cache we needed to forward all requests to the forums directory to the new QD Engage site.

The htaccess Redirection Goal:

The old forums directory was actually /community with links structured similar to /community?wpforumaction=viewforum&f=3.0 or similar. The new Engage site has been launched on a new sub domain which is http://engage.question-defense.com . The overall goal is to take any traffic destined for /community and community/$ and redirect to the new Engage URL. Below is the .htaccess RewriteRule we used to accomplish our goal.

.htaccess RewriteRule To Redirect All Traffic From One Directory To A New URL:

RewriteRule ^community(.*)$ http://engage.question-defense.com/ [L,R=301]

If you don’t have any other .htaccess rewrite rules then you need to turn on the RewriteEngine. Below would be an example of using .htaccess only for the redirection of one directory.

.htaccess Rewrite All Traffic To One Directory To a New URL:

RewriteEngine On
RewriteBase /
RewriteRule ^community(.*)$ http://engage.question-defense.com/ [L,R=301]

As you can see the above will redirect any traffic destined for /community to http://engage.question-defense.com.


Apache Cookbook

Rich Bowen. O’Reilly Media 2008, Paperback, 320 pages, $18.00

4.0


Apache Security

Ivan Ristic. O’Reilly Media 2005, Paperback, 432 pages, $19.99

5.0

DeliciousStumbleUponDiggTwitterMixxTechnoratiFacebookNews VineLinkedInYahoo! Bookmarks
Related posts:
  1. .htaccess Redirect All Traffic to www There are a couple things that need to be considered...
  2. LiteSpeed Web Server: Redirect All Web Traffic to HTTPS Except One Directory Or URL LiteSpeed web server uses the same Rewrite engine that Apache...
  3. Use .htaccess To Redirect One Domain To Another Domain I have been using a WordPress plugin for awhile called...
  4. How To Redirect All Litespeed HTTP Traffic To HTTPS The below explains the steps necessary to redirect all Litespeed...
  5. Simple SEO URL: Request Exeeded The Limit Of 10 Internal Redirects I was hired to install some ZenCart plugins recently one...

Tags: , , , , , , , , ,
4 Responses to “Use htaccess To Redirect All Traffic To One Directory To A New URL”
  1. z2gt user says:

    hi it seems this page redirects your original referrer what do you think

    [Reply]

    alex Reply:

    Hello z2gt,

    Not sure what you mean.

    Thanks.
    alex

    [Reply]

  2. chodhry says:

    Can this redirect all pages in that directory to the new location?

    For example I have over 50k pages under “forums” on my domain which I now want to move under “forum”. Can I use the rule like

    RewriteRule ^forums(.*)$ forum/ [L,R=301]

    [Reply]

    alex Reply:

    Hello chodhry,

    If you want all 50K pages to redirect to the new forums homepage the RewriteRule in the article will work. If you want the forum URL structure to be maintained then it needs to be modified to work.

    Thanks.
    alex

    [Reply]

  3.  
Leave a Reply