As described on URL Canonicalization article we published in March, having a unique URL ("canonicalization") for each webpage is important in improving your "Pagerank". Canonicalization is accomplished by redirecting non-standard webpages to a preferred ("standard") webpage. There are a number of ways to redirect a webpage, but 301 (HTTP/1.1 Status Code, "Moved Permanently") redirect is the search engine friendly method which passes the pagerank and search engine ranking status from old to a new page. Here is an examples of how 301 redirect can be implemented on LAMP (Linux/Apache/Mysql/PHP) environment.
PHP Redirect
<?php
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?>
Apache .htaccess: non-www to www subdomain redirect
1. Make sure your httpd.conf file has the "Directory" directive with the "AllowOverride All" setting.
<Directory /path/to/your/domain/document/root>
AllowOverride All
</directory>
2. Enable Mod-Rewirte Module
Your apache configuration should have the mod-rewrite module enabled, which is the default. You can verify this by perusing httpd.conf file for the following line:
LoadModule rewrite_module modules/mod_rewrite.so
3. Create a .htaccess file in the document root directory of your website with the following content.
RewriteEngine On
RewriteCond %{http_host} ^webtrafficexchange.com [nc]
RewriteRule ^(.*)$ http://www.webtrafficexchange.com/$1 [r=301,nc]
Just replace the "webtrafficexchange.com" with the domain name you're trying to redirect.
Comments
Meta Refresh Redirect
You may redirect a user to new page via Meta Refresh.
By having content=0 (0 second wait before redirect) causes 30x (301 or 301 redirect) depending on the search engine.
The Meta redirect will only work on browsers where it is supported. Visitors can disable the meta refresh feature in their browser for security reasons.
Add new comment