Category Archives: URL Rewriting

URL Rewriting – An Introduction

1. Rewriting all URLs ENDING with “my-string” and sending it to my-file.php $ indicates end of string. i.e. match any URI ending with string preceding $ Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} /my-string$ RewriteRule … Continue reading

Posted in URL Rewriting | Leave a comment

Canonical URL solution – redirect non-www to www and index.php to your homepage

Canonical URL issue has always been a headache to the Webmasters and SEOs. But thanks to apache’s mod_rewrite which provide nice escapes for this problem 1. Rewrite all your urls WITHOUT www to WITH www Options +FollowSymLinks RewriteEngine on RewriteCond … Continue reading

Posted in SEO, URL Rewriting, Webmaster Issues | Leave a comment

URL Rewriting with .htaccess

A quick guide to URL Rewriting #Start URL Rewriting Options +FollowSymLinks RewriteEngine on #This will rewrite all non-www urls with www # ie http://example.com will be rewritten as http://www.example.com RewriteCond %{HTTP_HOST} ^example.com RewriteRule (.*) http://www.example.com/$1 [R=301,L] #This statement ReDirects all … Continue reading

Posted in SEO, URL Rewriting | Tagged | Leave a comment

htaccess cheat sheet

1. Rewrite All URLs on one domain to new domain Put the following code in the .htaccess file of your old domain Options +FollowSymLinks RewriteEngine on RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L] 2. Rewrite non-www urls with www Options +FollowSymLinks RewriteEngine on … Continue reading

Posted in SEO, URL Rewriting | Tagged , | Leave a comment