I'm trying to set up a rewrite rule for a domain (www.domain2.com). I've already got a domain (www.domain1.com) pointing to the same server and document root. So this second domain (www.domain2.com) is a ServerAlias.
The site is drupal driven with clean URL's activated. That means that I already have rewrite rules in my conf. This is the rewrite rule that I currently have:
- Code: Select all
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
I've written a new module that's accessed at this URL (and this is with drupal's rewrite rule):
www.domain1.com/movies/search
without drupal's rewrite rule it is accessed here:
www.domain1.com?q=movies/search
When I do a search on this page it will append that to the end like this:
www.domain1.com/movies/search?var1=test&var2=hello
What I want now is to have a rewrite rule that rewrites:
- Code: Select all
www.domain1.com/movies/search or www.domain1.com?q=movies/search
into
www.domain2.com/
and with a search
www.domain2.com/?var1=test&var2=hello
This is what I came up with (it obviously doesnt work):
- Code: Select all
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=movies/search$1 [L,QSA]
I've also tried to combine this rule with drupal's like this:
- Code: Select all
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ movies/search$1 [QSA]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
But as I said it won't work like I want it to :/
Anyone out there who can help me, I would really appriciate it!