Benefits of URL rewriting

Associate
Joined
13 Nov 2003
Posts
1,567
Location
Manchester
Hi All

Working on our site at work, cant mention the name on here. At the moment the site uses horrible URLS ie product_details.asp?id=blahblah or category.asp?catid=blflfrlf&subcatid=dasdasdasd

Now I want to rewrite these to nice urls, ie www.mydomain.com/products/productcode

I am trying to justify the work to my boss and need some help thinking of good reasons lol

So far I have;

1. Future proofing
2. More SEO friendly
3. More user friendly

Can you guys think of any more

Ta
Aaron
 
1. Easy to understand
2. Seach Engine Optimisation
3. Security (See below)
4. Must be others

Say you have a link:

index.php?page=news&id=23

Now any hacker knows that page and id is a variable so they could try to do whatever to hack the site. But if your write it as:

/news/23/

They now have no idea what the variables are called to they cant try to hack.
 
Sorry to go OT... But out of interest, how do you go about doing this? When ever I've seen sites with URL's like that I assume they've gone to lengths of making folders and subfolders, which is obviously not right..
 
KingAdora said:
Sorry to go OT... But out of interest, how do you go about doing this? When ever I've seen sites with URL's like that I assume they've gone to lengths of making folders and subfolders, which is obviously not right..

Here is a subset from a gaming site im making, its really quite easy. Just write a .htaccess file:

Code:
RewriteEngine On
RewriteBase /

RewriteRule ^news/?$			index.php?p=news
RewriteRule ^news/([0-9]+)/?$		index.php?p=news&id=$1
RewriteRule ^scenenews/?$		index.php?p=scenenews
RewriteRule ^scenenews/([0-9]+)/?$	index.php?p=scenenews&id=$1
RewriteRule ^roster/?$			index.php?p=roster
RewriteRule ^roster/([0-9]+)/?$		index.php?p=roster&id=$1
RewriteRule ^matches/?$			index.php?p=matches
RewriteRule ^matches/([0-9]+)/?$	index.php?p=matches&id=$1
RewriteRule ^forum/?$			index.php?p=forum
RewriteRule ^sponsors/?$		index.php?p=sponsors
RewriteRule ^sponsors/([0-9]+)/?$	index.php?p=sponsors&id=$1
RewriteRule ^awards/?$			index.php?p=awards
RewriteRule ^awards/([0-9]+)/?$		index.php?p=awards&id=$1
RewriteRule ^demos/?$			index.php?p=demos
RewriteRule ^demos/([0-9]+)/?$		index.php?p=demos&id=$1
RewriteRule ^media/?$			index.php?p=media
RewriteRule ^media/([0-9]+)/?$		index.php?p=media&id=$1
RewriteRule ^interviews/?$		index.php?p=interviews
RewriteRule ^interviews/([0-9]+)/?$	index.php?p=interviews&id=$1
 
Back
Top Bottom