Website Redirection is a very phenomenal case when it comes to handling large and huge websites
and blogs with broken permalinks etc
In this case we always look forward to use htaccess redirection as it is very much fast and instantaneous
Here I shall discuss some facts and tips on htaccess Redirection
Facts on htaccess Redirection:
- htaccess redirection makes it different from other redirection techniques as it is independent, instantaneous, fast and delay free
- There is a very clear difference between 301 Permanent Redirect and 302 Temporary Redirect and should always be kept in mind
- htaccess Redirection can only work on Windows Servers
- htaccess files should always be transfered or uploaded in ascii mode to keep the blockquote safe and stable
Following the facts here are some good tips and examples on htaccess Redirection
Tips To Use htaccess Redirection:
Redirect non-www to www:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yoursite.com [NC]
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301]
Redirect www to non-www:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^example.com
RewriteRule (.*) http://example.com/$1 [R=301,L]
Redirect a whole Website:
Redirect 301 / http://www.example.com/
Redirect a single web page:
Redirect 301 /oldpage.html http://www.example.com/newpage.html
Redirect example.com/index.php to example.com/ :
Options +FollowSymLinks
RewriteEngine on
# index.php to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3, 9} /.*index.php HTTP/
RewriteRule ^(.*)index.php$ /$1 [R=301,L]
I hope the post was useful and gave a deep in sight of how to use htaccess Redirection






















Oh man, don’t remember me!
Remember the silly ” ` ” in one of my posts` title! I was having a lot of such stupid mistakes that make a lot of 404 pages when I changed them later :s
This is only one of the misery
Another one when I moved from /2007/12/03/post to /post
and the broken feeds links :s
Good post, keep up the good work
Nice post but i think it can also work on linux servers too well i use it on linux server !
.htacess WILL work on Linux systems too. You might want to do this:
htaccess Redirection can only work on Windows Servers