Neub on mod-rewrite please be gentle
I tried some of the examples on this forum.
to come up with a mod rewrite for
xxxx-yyyy.domain.com = domain.com/search.php?q=yyyy:xxxx:
its also ok if the output would be
xxxx.domain.com = domain.com/search.php?q=yyyy:xxxx:
as long as it would not mess with other variables of yyyy
and also work with
zzzz.domain.com = domain.com/search.php?q=zzzz
here is my unfinished code so far.
- Code: Select all
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.smilingpet\.com
RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)\.smilingpet\.com
Rewriterule ^$ /search.php?q=category:%2: [L]
Rewriterule ^$ /search.php?q=brand:%2: [L]
Rewriterule ^$ /search.php?q=merchant:%2: [L]
Rewriterule ^$ /search.php?q=%2 [L]
It works only on category (first line)
How can i modify the code to work with the brand and merchant subdomains conditions?
I am also getting
an error on browsing the main domain
smilingpet.com
and
www.smilingpet.com
it shows the results of page
http://smilingpet.com/search.php?q=category::