|
-
May 29th, 2008, 01:02 PM
#1
Thread Starter
New Member
-
May 29th, 2008, 01:19 PM
#2
Hyperactive Member
Re: DIGG.COM's url formatting - how to.
No, it's called Rewrite rules on the web server.
Apache = mod_rewrite
IIS = ISAPIRewrite
Lighttpd = Built in
You can rewrite URLs such as /politics/* to index.php?page=*, then handle it accordingly.
For example you could have something like /hello-world/ redirect to hello-world.php.
» Twitter: @rudi_visser : Website: www.rudiv.se «
If Apple fixes security flaws, they are heralded as proactive. If Microsoft fixes a security flaw, they finally got around to fixing their buggy OS.
-
May 29th, 2008, 01:20 PM
#3
Re: DIGG.COM's url formatting - how to.
I dont like to say this, mainly because I think I do it wrong, but I have used a method like this.
I have a URL, e.g. http://www.mysite.com/Never_guess_what,
As this 'directory' doesnt exist it fires a 404 error, I then catch that error, query the URL and redirect to the page of choice.
Of course on your server you have to be able to control your 404 (400, 403, 500 errors), but if you can do that send the error to a custom script, grap the URL using the $_SERVER variable and boom, sorted.
-
May 29th, 2008, 09:30 PM
#4
Re: DIGG.COM's url formatting - how to.
 Originally Posted by ILMV
I dont like to say this, mainly because I think I do it wrong
Yeah, you are doing it wrong. Your method will probably (depending on the web server) still send a 404 status code back to the client. Although this probably won't affect a human, it will mean that any automated tool — such as a search engine crawler — will think that no page exists at that address.
The rewriting option is the correct method of achieving proper virtual URIs as this does not affect the status code.
Example for Apache:
Code:
RewriteEngine On
RewriteRule ^.*$ /home/www/index.php [L]
That will pass all requests through to /home/www/index.php. You can then parse the variable $_SERVER['REQUEST_URI'] and serve the appropriate content.
Last edited by penagate; May 29th, 2008 at 09:33 PM.
-
May 31st, 2008, 07:46 PM
#5
Thread Starter
New Member
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
|