php - URL rewrite with subdomain and additional parameters -


i have variant subdomain requires rewrite , multiple additional parameters @ of url after slashes.

my current rewrite rules follows:

rewritecond %{http_host} ^((?!www).+)\.classifiedads4free\.com$ [nc] rewritecond %{request_uri} !\.(?:jpe?g|png|gif|bmp|php)$ [nc] rewriterule (.*) pages/list.php?country=%1&category=%2 [l,qsa]  rewriterule    ^cat/([a-za-z0-9-]+)?$      pages/list.php?category=$1 [qsa,nc,l] 

i can access each individual rewrite in when go http://us.classifiedads4free.com. can read country parameter. when go http://classifiedads4free.com/cat/jobs, can read category parameter.

but i'm not able correct parameters http://us.classifiedads4free.com/cat/jobs.

only country parameters gets shown. how make such both parameters accounted for?

you can have 1 rule per rewritecond(s) need include condition picks country again along rule. , still need standalone rule when country code absent.

rewritecond %{http_host} ^((?!www).+)\.classifiedads4free\.com$ [nc] rewritecond %{request_uri} !\.(?:jpe?g|png|gif|bmp|php)$ [nc]   rewriterule ^cat/([a-za-z0-9-]+)?$ pages/list.php?country=%1&category=$1 [qsa,nc,l]  rewritecond %{http_host} ^((?!www).+)\.classifiedads4free\.com$ [nc] rewritecond %{request_uri} !\.(?:jpe?g|png|gif|bmp|php)$ [nc]   rewriterule (.*) pages/list.php?country=%1&category=%2 [l,qsa]  rewriterule    ^cat/([a-za-z0-9-]+)?$      pages/list.php?category=$1 [qsa,nc,l] 

also it's important rule first, otherwise (.*) consume cat/... , select wrong rule


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -