Forum Moderators: phranque

Message Too Old, No Replies

custom urls

         

Endeavor

4:16 am on May 26, 2005 (gmt 0)

10+ Year Member



How can I redirect a user based on the url he typed in. Here's what I mean: If I was making a dictionary, then let's say that the user types in [mysite.com...]
Now I need to redirect to a server script, and give a variable to that script with the value of "word". I tried to use AliasMatch, and similar directives in mod_alias, but I'm not familiar with them. So I'm not sure if it would work using those. How can I accomplish this task?

jdMorgan

4:37 am on May 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Endeavor,

Welcome to WebmasterWorld!

This is a trivial case of the technique used to rewrite static URLs to dynamic URLs, as described in the mod_rewrite documentation and in many threads here. A current eaxmple is here [webmasterworld.com].

That thread should get you started, and there are links to some relevant basic reference material in our forum charter [webmasterworld.com]. Once you've reviewed these resources, we can discuss your specific questions in this thread.

To make your job easier, and to allow for easy maintenance and growth in the scope of your example dictionary site, I'd recommend that you use the URL http://example.com/dictionary-<word> or http://example.com/words/<word>. This will allow you easily keep your "data" and site infrastructure in separate directories, and avoid "collisions" between your data and filenames. (For example, what if your script is named "index.php" and the word to be looked up is "index.php"? For an actual example of such a naming collision, see this recent thread [webmasterworld.com].)

Jim