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.
hi it seems this page redirects your original referrer what do you think
Hello z2gt,
Not sure what you mean.
Thanks.
alex
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]
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