301 redirect 173
RewriteEngine on
RewriteCond %{HTTP_HOST}
^([^.:]+\.)*oldsite\.example\.com\.?(:[0-9]*)?$ [NC]
RewriteRule ^(.*)$ http://newsite.example.net/$1 [R=301,L]
Use of .htaccess for this purpose usually does not require administrative permissions. However, .htaccess can be
disabled by your host, and so may not work (or continue to work) if they do so.
In addition, some server configurations may require the addition of the line:
Options +FollowSymLinks
ahead of the "RewriteEngine on" directive, in order to enable the mod_rewrite module.
When you have access to the main Apache config files (such as httpd.conf), it is best to avoid the use of .htaccess
files.
If the code is placed into an Apache config file and not within any <Directory> container, then the RewriteRule
pattern must be changed to include a leading slash:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.:]+.)oldwebsite.com.?(:[0-9])?$ [NC]
RewriteRule ^/(.*)$ http://www.preferredwebsite.net/$1 [R=301,L]
Refresh Meta tag and HTTP refresh header
Netscape introduced a feature to refresh the displayed page after a certain amount of time. This method is often
called meta refresh. It is possible to specify the URL of the new page, thus replacing one page after some time by
another page:
- HTML tag [13]
- An exploration of dynamic documents [14]
- • Meta refresh
A timeout of 0 seconds means an immediate redirect. Meta Refresh with a timeout of 0 seconds is accepted as a 301
permanent redirect by Google, allowing to transfer PageRank from static html files.[15]
This is an example of a simple HTML document that uses this technique:
Please follow this link.