Skip to main content
Inspiring
November 9, 2011
Question

URL form - www.mywebsite.com/propertyname/

  • November 9, 2011
  • 1 reply
  • 552 views

I'm working on a project that is going to involve each property currently stored in a database having its own page.

The way I'm used to doing it (using PHP and mySQL) would be to have a page listing the properties, and a details page of the form:

www.mywebsite.com/property_details.php?PropertyID=101

Is there any way of having a URL of the form:

www.mywebsite.com/propertyname/

?

This topic has been closed for replies.

1 reply

Participating Frequently
November 9, 2011

You can use the rewrite engine. However, the engine needs to be able to convert a friendly name to the dynamic page parameter. So, you could either convert the PropertyID from numeric to a string value to hold the propertyname, or better, add a new unique column to the database for the PropertyName and modify the property_details.php script to retrieve the property by that column.

Inspiring
November 10, 2011

Thanks for that - I did have a rummage last night and found some stuff about the rewrite engine.I got as far as seeing it needed some Apache thing to be running, and checked on a phpinfo.php page and saw that it wasn't, so I've fired off an email to the hosting company to see if its something that can be set up on the server.

If all else fails, as the pages will all be the same, and subject to how many are needed, I guess I can always create a page for each, and just change the SQL query in each to pull the data from the required record.