Rewriting URLs to use www with permanent redirect.

Rewriting URLs to use www with permanent redirect.

Postby shakir » Sun Mar 07, 2010 9:41 am

The following rewrite rule enables all requests to a site to go through via its www URL, theoretically improving search engine 'optimization' (if there is such a thing).

The important thing here is that any file or directory request following the url is kept during the redirect (I've seen poor rewrites on sites that just redirect from http://whatever.com to the front page and the user loses their path to the link they clicked on once already).


RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule ^.*$ http://www.example.com%{REQUEST_URI} [R=permanent,L]


regards

shakir hussain
shakir
 
Posts: 26
Joined: Mon Feb 15, 2010 11:23 pm
FullName: Shakir Hussain

Return to General questions and Ideas

Who is online

Users browsing this forum: No registered users and 1 guest

cron