Posts Tagged redirect
htaccess Redirect File Or Directory
Posted by Wil in htaccess tutorials on June 27, 2009
If you moved files from one directory or changed directory location, you will find it useful to redirect all your visitors to the true directory that contains all the files in it . Apache server was designed to allow manually redirection of all your traffic from “wrong” directory to the true directory, this method is also excellent for SEO practice, wrong pages will not been cached by search engines.
Here is .htaccess code for this task :
redirect 301 /oldfiles/mypage.html http://www.example.com/newfiles/mypage.html
We used 301 redirect command to redirect one file from one directory to another , and you should specify your “wrong” path (/oldfiles/mypage.html) and “true” path
(http://www.example.com/newfiles/mypage.html)
Sometimes we will throw our traffic to the new directory permanently , and here is .htaccess code
Redirect permanent /oldfiles/ http://www.example.com/newfiles/
You can modify your .htaccess file in your free time.
htaccess redirect site
Posted by Wil in htaccess tutorials on June 27, 2009
There are a lot of reasons to redirect website from one to another, for example when you changed your main domain name and want all traffic to be redirected to your new website domain name.
Instead of using slow html meta redirect function, it is a good idea to send command to your server directly.
Here is the code for .htaccess file to send your visitors to another domain name:
RewriteEngine On
RewriteRule ^(.*)$ http://www.htaccessfile.com/$1 [R=301,L]
Where http://www.htaccessfile.com is desired url you want to send traffic to.
If you want redirect to be permanent, you can use this command :
Redirect permanent / http://www.domain.com/