How to redirect url permanently in Apache
One day you may want to rename your domain name to a new one due to inappropriate use of the old domain. However, the old domain is still valid and still valuable for search engines. It is possible to redirect all existing urls to the new domain gracefully. For example, http://abc.com/node/8 to http://def.com/node/8. Whenever one tries to access http://abc.com/node/8, webbrowser will be automatically redirected to http://def.com/node/8. This behavior also applies to search engines.
The trick is to use mod_rewrite in Apache HTTP Server
Below is my .htaccess
of abc.com.
RewriteEngine on RewriteRule ^(.*)$ http://def.com/$1 [L,QSA,R=301]
Tags: apache, domain name
- sugree's blog
- 2006 reads
Post new comment