Jump to content

Is this a crazy way to do this...?


henryhenry

Recommended Posts

I want to have nice user-friendly urls but I have a few challenges. Bear with me here - I'm still learning so there may be some very obvious errors!I have different pages categorised a bit like this:group x - category 1 - product a - product b - category 2 - category 3group y - category 2 - category 3group z - category 3 - category 4 - category 5etc etc. Some things come under multiple headings. I want to have the URL a bit like www.test.com/groupx/category1/producta.phpMy current plan is to have a set of empty folders. Then when you load the URL, I have my script take the URL as a string and cut it up getting the group, category and product names, then look up primary keys on my DB. Then I get PHP to copy the producta.php into the empty folder while it's being used. Finally, after the user leaves the page, the file copy is deleted, leaving an empty folder again.Is this a crazy way to do this? I have searched quite a lot without much success in finding a method.Thanks as ever!

Link to comment
Share on other sites

Yes, that is a crazy way to do that. Instead you can redirect all requests to a single PHP file, so the URL /groupx/category1/producta.html would instead load /products.php?group=x&category=1&product=a. Do a Google search for "mod_rewrite" to get you started, that is the tool that you can use to perform the translation.

Link to comment
Share on other sites

Thanks once more!mod_rewrite is exactly what I was looking for. sometimes you have to wonder about google - you search for what seems obvious and NOTHING :) It's all about knowing the language!getting mod_rewrite to work is another story of course! but I'm working on that!Henry

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...