fellz
asked on
htaccess: reorder variables in clean-urls using RewriteRule
Hi,
Currently our URLs look like that:
http://mydomain.com/site2009/pages/welcome.php?sid=de|1000|317|f10.0.22|1921680156521|welcome
We want to use clean-urls - the solution should be made using htaccess so that the URLs look like that:
http://mydomain.com/de/welcome/1000/317/1921680156521/f10.0.22
Many thanks in advance!
Currently our URLs look like that:
http://mydomain.com/site2009/pages/welcome.php?sid=de|1000|317|f10.0.22|1921680156521|welcome
We want to use clean-urls - the solution should be made using htaccess so that the URLs look like that:
http://mydomain.com/de/welcome/1000/317/1921680156521/f10.0.22
Many thanks in advance!
You need to use http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritemap with external rewriting program.
ASKER
Thanks for the hint. However - what I'm looking for is the complete solution (htaccess-code) to paste it and go.
RewriteCond %{REQUEST_URI} /site2009/pages/welcome.ph p
RewriteRule ^.*welcome.php\?sid=([^|]* )\|([^|]*) \|([^|]*)\ |([^|]*)\| ([^|]*)\|( .*) /$1/welcome/$2/$3/$5/$4
RewriteRule ^.*welcome.php\?sid=([^|]*
ahoffmann, the rule should go the other way i suppose. And I assume the number of variables(the length of url) is variable - that's why suggested external rewrite map.
ASKER
yes, ravenpl is right:
entering the following in the browser
http://mydomain.com/de/welcome/1000/317/1921680156521/f10.0.22
should call
http://mydomain.com/site2009/pages/welcome.php?sid=de|1000|317|f10.0.22|1921680156521|welcome
behind the scenes
entering the following in the browser
http://mydomain.com/de/welcome/1000/317/1921680156521/f10.0.22
should call
http://mydomain.com/site2009/pages/welcome.php?sid=de|1000|317|f10.0.22|1921680156521|welcome
behind the scenes
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
many thanks for the solution, ravenpl!
there's just one more question: is there a chance to make it work when the number of variables is not constant but at least limited to a maximum of say 10 variables?
there's just one more question: is there a chance to make it work when the number of variables is not constant but at least limited to a maximum of say 10 variables?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
great! many thanks!