xxxx-yyyy.domain.com = domain.com/search.php?q=yyyy:xxxx:

Using a single web hosting account to host multiple sites

xxxx-yyyy.domain.com = domain.com/search.php?q=yyyy:xxxx:

Postby lordx » Wed Jan 24, 2007 9:38 pm

Nice forum!

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::
lordx
 
Posts: 5
Joined: Wed Jan 24, 2007 9:19 pm

Postby richardk » Fri Jan 26, 2007 10:00 am

You can't have rules that match the same thing (they all match nothing with ^$ at the moment).

xxxx-yyyy.domain.com = domain.com/search.php?q=yyyy:xxxx:

Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} !^(www\.)?domain\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)-([^\.]+)\.domain\.com$ [NC]
RewriteRule ^$ /search.php?q=%3:%2: [L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby lordx » Fri Jan 26, 2007 8:27 pm

richard, thanks again for the help!

its working now.

best regards,

alex
lordx
 
Posts: 5
Joined: Wed Jan 24, 2007 9:19 pm


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 74 guests

cron