Web Development Tools

new technology induction

  • Review developercase.wordpress.com on alexa.com

htaccess 301 folder redirect

Posted by Ravi Saxena on May 11, 2011

To redirect a complete website, one needs to do the following changes to the root .htaccess file:

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [NC]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,NC]

However points to remember when there is some one-t-one relationship in the redirection. As in the case you might be required to have all the 3 conditions:

  • redirect some high traffic pages to particular different pages on a different domain,
  • redirect entire folders to some other folder,
  • redirect rest of the pages to a different domain altogether.

Example:

1. Redirect a particular page:

RewriteRule ^2011/05/vtiger-pbx-integration.html http://www.amosvision.com/web-development/crm-modules-development.html [L,R=301]

2. Redirect entire folder:

RewriteRule ^2011/05/ http://www.amosvision.com/ [L,R=301]

3. Redirect rest of the pages:

RewriteRule ^/ http://www.amosvision.com/ [L,R=301]

In this case the RewriteRule sequence must be followed for all the requirements to be correctly meet.

Related Links:

3 Responses to “htaccess 301 folder redirect”

  1. […] htaccess 301 folder redirect […]

  2. Hello! I know that is sort of away from topic even so I would decided I might ask. Are you thinking about investing links or maybe visitor composing your blog report or perhaps vice-versa? Our blog talks about most of the identical subjects because the one you have and i believe we could greatly reap the benefits of the other. If you’re fascinated twenty-four hours a day capture us a good e-mail. My spouse and i look forward to talking with a person! Outstanding blog site in addition!

  3. Why is this there is no need your web internet site viewable inside wap format? cant discover anything at all within my iphone 3gs.

Leave a comment