Forum Moderators: phranque
I want to know if Apache can dynamically create a URL string based on a URL entered in a web browser.
I've researched mod_rewrite and obviously it's one of the more advanced Apache features.
So here goes...
A user will enter the address below. The unique 11 character ending is different for each page.
http://www.example.org/campcode.html?camp=NEHA0618LDC
We want the server to take the last 11 characters and place them in a new URL string and pass the URL to the server.
http://www.example.org/campcode.html?camp=https://teamnet.fca.org/camp/info/NEHA0618LDC?OpenDocument
Is this possible using mod_rewrite?
Anyone have any other ideas? Code?
I've never used mod_rewrite. It looks like a beast!
We're trying to make the URL smaller and more manageable and letting the server do the work.
Any help is greatly appreciated!
Thanks!
-Danny
[edited by: jdMorgan at 10:59 pm (utc) on Dec. 4, 2006]
[edit reason] Examplified. No URLs, please. See TOS. [/edit]
The concepts you need are:
In .htaccess, the code would look something like this (adjust to suit).
RewriteCond %{QUERY_STRING} ^camp=([A-Z0-9]+)$
RewriteRule /campcode\.html$ /campcode.html?camp=https://teamnet.example.org/camp/info/%1\%3fOpenDocument [NE,L]
For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].
Jim