Second domain to add/modify query string


Second domain to add/modify query string

Postby thedrake » Wed Feb 03, 2010 10:41 am


We're using a CMS (Drupal) that serves all pages based on a query string (

Drupal comes with rewrite rules to allow "clean URLs" (so is rewritten to, and also to force a www prefix

We are adding a second domain to the site that needs to insert a string at the beginning of the query string (so should be rewritten to

The following rewrite rule seems to be working as I hoped, with one exception: the "root" page. Any advice would be greatly appreciated.

Code: Select all
Options +FollowSymLinks
DirectoryIndex index.php
RewriteEngine on

# existing Drupal www. prefix
RewriteCond %{HTTP_HOST} siteA\.com$ [NC]
RewriteCond %{HTTP_HOST} !^www\.siteA\.com$ [NC]
RewriteRule ^(.*)$$1 [L,R=301]

# rewrite rules for
# works for, but not for root
RewriteCond %{HTTP_HOST}   ^(www\.)?siteB\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/siteB(/.*)?$ [NC]
RewriteCond %{REQUEST_URI} !^index.php\?q=siteB(/.*)?$ [NC]
RewriteRule ^(.*)$         index.php?q=siteB/$1 [QSA,L]

# existing Drupal clean URL rewrite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
Posts: 1
Joined: Wed Feb 03, 2010 9:05 am

Return to New Threads/Problems

Who is online

Users browsing this forum: No registered users and 2 guests