Forum Moderators: phranque
RewiteRule /regions/([a-z-a-z]+).html /accomm_scripts/accomm_srch_map.php?Region=$1 [N]
This succesfully rewites my links like this:
/regions/ontario-toronto.html
Now what I need is a Rule for this:
/ontario-toronto/toronto.html (ontario-toronto is my region and toronto is my city)
Heres the script part:
/accomm_scripts/accomm_city_srch.php?city=toronto®ion=ontario-toronto
Many Thanks
Phil
/accomm_scripts/accomm_city_srch.php?city=$city®ion=$prov
$prov is a variable from this:
$prov = $_GET['region'];
if ($_GET['region']){
$prov = $_GET['region'];
}
I have tried this but its not working:
RewriteRule /$prov/([a-z]+).html /accomm_scripts/accomm_city_srch.php?city=$1®ion=$prov
This isnt working..can one have those variables in the RewriteRule like $prov?
Many Thanks
Phil
Welcome to WebmasterWorld!
I have tried this but its not working:RewriteRule /$prov/([a-z]+).html /accomm_scripts/accomm_city_srch.php?city=$1®ion=$prov
This isnt working..can one have those variables in the RewriteRule like $prov?
mod_rewrite has no concept of the "meaning" of any pattern, so arbitrary variable names are not allowed.
You will need something like this:
RewriteRule ^/([^/]+)/([^.]+)\.html$ /accomm_scripts/accomm_city_srch.php?city=$2®ion=$1
See the references in our forum charter [webmasterworld.com] for more information.
Jim
The RewriteRule is:
RewriteRule ^/([^/]+)/([^.]+)\.html$ /accomm_scripts/accomm_city_srch.php?city=$2®ion=$1
Many Thanks
Phil
I'm guessing this isnt a good URL
Is there a way to put the space prob in the RewriteRule directly? Make mod rewrite replace a space?
Is this a possible soluttion?
rewriteCond %{ENV:space_replacer}!^$
Phil
RewriteRule ^/([^/]+)/([^-]+)-(.*)\.html$ /$1/$2\ $3.html [N]
RewriteRule ^/([^/]+)/([^.]+)\.html$
/accomm_scripts/accomm_city_srch.php?city=$2®ion=$1[L]