Forum Moderators: coopster & phranque

Message Too Old, No Replies

Clever URL Changing

How do I have URL's Like the OPD?

         

annefromuk

5:42 pm on Feb 11, 2002 (gmt 0)

10+ Year Member



After using DMOZ I noticed that if you change a character in the URL to lowercase, it will change it back after you hit enter.

If you type /society/People/ it will change the URL to /Society/People/
It does not matter what word you type in lowercase, it will always change it back!.

And it will even add a trailing / if it is missing.

Any Ideas of how they do this, as I am going to be using PHP and Mod_Rewrite to make a local interests directory.

Thanks

ggrot

6:11 pm on Feb 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just deliver all 404 errors to a PHP script that parses the $PHP_SELF variable to find the path used. Apply upper/lower case formatting to the url according to your site layout. Then send the new url back to the browser as a permanent redirect header.

annefromuk

11:05 pm on Feb 11, 2002 (gmt 0)

10+ Year Member



Thanks for the info.

The $PHP_SELF looks like what I need to use.

But may I ask if you have any extra tips on how I could apply the upper/lower case formatting?
And how to add a trailing slash / if missing?

Regards

amoore

11:14 pm on Feb 11, 2002 (gmt 0)

10+ Year Member



in apache, mod_dir [httpd.apache.org] handles redirecting requests for directories without trailing slashes to ones with trailing slashes.

It's also responsible for sending a default page (like index.html) instead of a directory listing.

amoore

11:31 pm on Feb 11, 2002 (gmt 0)

10+ Year Member



and similarly, it appears that mod_speling [httpd.apache.org] will correct capitalization errors, though I have not tried it. The documentation mentions a redirection, so I imagine that it would have the effect of correcting the text in the URL bar of the browser as well.