Title: .htaccess redirection
Last modified: August 18, 2016

---

# .htaccess redirection

 *  [hostwolf](https://wordpress.org/support/users/hostwolf/)
 * (@hostwolf)
 * [18 years, 11 months ago](https://wordpress.org/support/topic/htaccess-redirection-1/)
 * I am trying to redirect all non www incoming posts to www via .htaccess. After
   installing my blog I used the non www setting for about a month but changed that
   now and want all incoming links to be redirected.
 * I´m half way there and have put this .htaccess in my blog folder
    RewriteEngine
   on RewriteCond %{HTTP_HOST} ^cheap-webhosting.in$ RewriteCond %{REQUEST_URI} 
   ^/blog/$ RewriteRule ^(.*)$ xxhttp://www.cheap-webhosting.in/blog/ [R=301,L]
 * # BEGIN WordPress
    <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /blog/
   RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule./
   blog/index.php [L] </IfModule>
 * # END WordPress
 * However, the urls of the specific posts are still not redirecting:
    e.g. [http://cheap-webhosting.in/blog/a-transfer-from-one-web-host-to-another/](http://cheap-webhosting.in/blog/a-transfer-from-one-web-host-to-another/)
 * Doesn´t the second line in my .htaccess mean: Redirect everything in the blog
   directory and everything thereafter to the www version
 * How can I implement this or have I already done this and what are the possible
   causes why this isn´t working?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Samuel B](https://wordpress.org/support/users/samboll/)
 * (@samboll)
 * [18 years, 11 months ago](https://wordpress.org/support/topic/htaccess-redirection-1/#post-561725)
 * This should help:
    [http://www.evolt.org/ultimate_htaccess_examples](http://www.evolt.org/ultimate_htaccess_examples)
   Scroll about 1/4 way down and it shows how to do seo friendly redirects.
 *  Thread Starter [hostwolf](https://wordpress.org/support/users/hostwolf/)
 * (@hostwolf)
 * [18 years, 11 months ago](https://wordpress.org/support/topic/htaccess-redirection-1/#post-561730)
 * Thanks samboll.
 * This looks like the best one to use to care of all eventualities without hard
   coding:
 * Options +FollowSymLinks
    RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI}!
   ^/robots\\.txt$ [NC] RewriteCond %{HTTP_HOST} !^www\\.[a-z-]+\\.[a-z]{2,6} [NC]
   RewriteCond %{HTTP_HOST} ([a-z-]+\\.[a-z]{2,6})$ [NC] RewriteRule ^/(.*)$ [http://%1/$1](http://%1/$1)[
   R=301,L]
 * I´m just wondering why is it {2,6} and not {1,9} ? Isn´t that statement supposed
   to take care of all numerals or am I missing something?
 * And what does the request for robots.txt do? Or what´s the purpose?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘.htaccess redirection’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [hostwolf](https://wordpress.org/support/users/hostwolf/)
 * Last activity: [18 years, 11 months ago](https://wordpress.org/support/topic/htaccess-redirection-1/#post-561730)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
