954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Friendly URLs

I’ve created a dynamic page (page.php) who’s content changes based on the incoming link, specifically by calling a GET on the ID in the URL. So, for example, someone visits www.domain.com/page.php?id=310 and the content on the page changes queries the database and returns results for item 310.

I’m in the process of redesigning a few things and I’m trying to figure out whether there is a way instead to make these URLs more “friendly.” So, instead of it being page.php?id=310 is there a way to create an alias (for lack of a better term) to make the URL more representative of the name of the product?

Any ideas/advice you all have are much appreciated! :)

jrotunda85
Junior Poster
144 posts since Feb 2011
Reputation Points: 19
Solved Threads: 7
 

apache mod_rewrite, applied in the .htaccess files can display mysite.com/page.php?id=310 as mysite.com/page310.php ,
or any other system you wish to set up
and the urls are 2way, so they can access page310.php as a typed url
the search for instructions would be something like THIS ,

(love that animation, not suggesting any lack of diligence on your part, such searches are easy if you already know what the rewrite module is called, just love that animation)

almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376
 

There's a great online generator here: http://www.generateit.net/mod-rewrite/

I'm a complete idiot at regex. This simplifies things considerably.

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

Your link to online generator is absolutely helpful. I was blur with regex. Big thanks

deselse
Newbie Poster
9 posts since Jun 2011
Reputation Points: 10
Solved Threads: 0
 
apache mod_rewrite, applied in the .htaccess files can display mysite.com/page.php?id=310 as mysite.com/page310.php , or any other system you wish to set up and the urls are 2way, so they can access page310.php as a typed url the search for instructions would be something like THIS , (love that animation, not suggesting any lack of diligence on your part, such searches are easy if you already know what the rewrite module is called, just love that animation)


thanks man that did the job for me

matricol
Junior Poster in Training
98 posts since Jun 2011
Reputation Points: 2
Solved Threads: 9
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: