Second domain to add/modify query string

CLOSED

Second domain to add/modify query string

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

Hello,

We're using a CMS (Drupal) that serves all pages based on a query string (siteA.com/index.php?q=pagename)

Drupal comes with rewrite rules to allow "clean URLs" (so siteA.com/pagename is rewritten to siteA.com/index.php?q=pagename), 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 siteB.com/pagename should be rewritten to siteA.com/index.php?q=siteB/pagename)

The following rewrite rule seems to be working as I hoped, with one exception: the "root" siteB.com 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 ^(.*)$ http://www.siteA.com/$1 [L,R=301]

# rewrite rules for siteB.com
# works for siteB.com/page, but not for root siteB.com
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]
thedrake
 
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 5 guests

cron