|
-
September 8th, 2010, 03:31 PM
#1
Clean URL / Semantic Web Question about Incoming requests (Web Dev Newbie)
Hi,
To give some context, I'm more of a newbie to putting a single modern web system together than any one technology. I have a question about incoming requests and returning the correct representation.
Problem:
1. User accesses information about an item through "http://example.com/doc/item/313" - For arguments sake, this is a shop item with unique id 313
2. "http://example.com/doc/item/313" (html) - doesn't exist on the server, it needs to be dynamically generated.
What step am I missing / do I need to do for the server to recognise this request, then run a php script that then returns the correct representation. In this case html, however if the user specifies .rdf or .json for example recognise that and allow the php script to make a call to return that representation.
I hope that makes sense! - any help appreciated.
Ross
-
September 8th, 2010, 06:13 PM
#2
Re: Clean URL / Semantic Web Question about Incoming requests (Web Dev Newbie)
Sorry...but I'm confused. Are you talking about mod_rewriting?
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
September 8th, 2010, 06:34 PM
#3
Re: Clean URL / Semantic Web Question about Incoming requests (Web Dev Newbie)
I suppose it doesn't help but I'm probably a little confused, I know what I want to achieve but don't quite know what it is called. Mod rewriting looks close but I'm not sure.
I need a clean URL basically that doesn't display any clue of it's implementation that when accessed by a browser can return the correct representation for the request. So from a standard browser:
http://www.example.com/doc/item/313
Will return a HTML file generated dynamically from a PHP script.
Now I know if i just wanted something like /index.php - I could do that, I just don't know what is needed to do that dynamically and using the redirect which means the .html / .php / .whatever isn't displayed.
So I think I need a redirect or something... so /doc/item/313 maps elsewhere.
Perhaps to a php controller function that can determine the representation and return it thus.
Is there a common name or design pattern that effectively explains this technique and how to achieve it?
-
September 8th, 2010, 10:37 PM
#4
Re: Clean URL / Semantic Web Question about Incoming requests (Web Dev Newbie)
Yes. It's called URL rewriting. It's done with mod_rewrite as I've already said. There are plenty of examples in the Google search I linked to.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|