Pretty URLs always helps you to boost up search engine page ranking. In this post I want to explain about URLs rewriting techniques using .htaccess file. Friendly URLs looks neat on the browser address bar.
Original URL.
Eg. http://flickr.com/users.php?id=username&page=2
Rewriting Friendly URL.
Eg. http://flickr.com/username/2
.htaccess Code
//First Parameer
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ users.php?user=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ users.php?user=$1
//Second Parameter
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)/([0-9]+)$ users.php?user=$1&page=$2
RewriteRule ^([a-zA-Z0-9_-]+)/([0-9]+)/$ users.php?user=$1&page=$2
Demo: http://www.9lessons.info/2009/11/pretty-urls-with-htaccess-file.html
0 comments:
Post a Comment