bibabutze
asked on
complex rewrite rule for mod rewrite
Hello Experts,
i´m really confused on writing a mod rewrite rule for my webpage runing on Apache Webserver. I have never done this befor and don´t know how to start. I only know how to make the .htaccess file and set the rule but don´t know how to write the rule.
i have a php script which need several params the link to a site look like:
index.php?id=1&city=Berlin &country=D E&zip=0123 4&uk=50&ed =today
or
index.php?id=1&city=Berlin &country=D E&zip=0123 4&uk=50&ed =tommorrow
or
index.php?id=1&city=Berlin &country=D E&zip=0123 4&uk=50&ed =20081023& page=3
The arrangement of the params can be different and params can be missing.
for example:
index.php?id=1&country=DE& zip=01234& city=Berli n&uk=50&ed =20081023
or
index.php?id=1&zip=01234&c ity=Berlin
how to write a rewrite rule that will give the following result?
mypage/Country-Zip-Citynam e/20081023 /index.htm l
or
mypage/Country-Zip-Citynam e/today/in dex.html
or
mypage/Country-Zip-Citynam e/today/pa ge_1.html
what happens if the country or zip param is not set?
i´m really confused on writing a mod rewrite rule for my webpage runing on Apache Webserver. I have never done this befor and don´t know how to start. I only know how to make the .htaccess file and set the rule but don´t know how to write the rule.
i have a php script which need several params the link to a site look like:
index.php?id=1&city=Berlin
or
index.php?id=1&city=Berlin
or
index.php?id=1&city=Berlin
The arrangement of the params can be different and params can be missing.
for example:
index.php?id=1&country=DE&
or
index.php?id=1&zip=01234&c
how to write a rewrite rule that will give the following result?
mypage/Country-Zip-Citynam
or
mypage/Country-Zip-Citynam
or
mypage/Country-Zip-Citynam
what happens if the country or zip param is not set?
ASKER
the id=1 is the default param. if you enter the site the id param is not set. If the id param is set it should look like mypage/Country-Zip-Citynam e/20081023 /1_index.h tml.
Also when i enter mypage/Cityname
the url should look like index.php?city=Berlin
is this possible with mod_rewrite
Also when i enter mypage/Cityname
the url should look like index.php?city=Berlin
is this possible with mod_rewrite
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> mypage/Country-Zip-Citynam
assuming that you mean the value from the parameter for the literals "Country", "Zip" and so on, what should be the value if the parameter is missing as in
> index.php?id=1&zip=01234&c
What happens to the id= parameter