After building a new website for a client, i needed to redirect their old URLs to new ones, normally a…
A recent project required that we use hash navigation for speedy access to content, this also eeded to be indexed…
add a trailing slash to all URLs. [code]RewriteCond %{REQUEST_URI} /+[^\.]+$ RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L][/code]
This example changes /product.php?product_id=909 to /product?id=909 [code]RewriteCond %{QUERY_STRING} product_id=(.*) RewriteRule ^product.php(.*) /product?id=%1[/code]
remove the www. [code]RewriteCond %{HTTP_HOST} !^domain.com$ [NC] RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301][/code]
[code]RewriteCond %{REQUEST_FILENAME}.php -f RewriteCond %{REQUEST_URI} !/$ RewriteRule (.*) $1\.php [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/$ /$1 [R=301,L][/code]
making sure all urls are beginning with the www. [code]RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L][/code]