Hello,
I'm using PT in a Wordpress multisite site environment. With some help of .htaccess, the multisite Wordpress plugin and the domainmmanager plugin I manage to run multiple comparison sites from one WP installation. These sites are installed as subdomains of my main site (for example site1.example.com) and using aliases and the .htaccess are mapped to www.site1.com etc.
I've now found out one little problem... Google indexed my site1.example.com/shopping directory as well and thinks I've got almost a million links to my site www.site1.com... I'm trying to fix this with a 301-redirect on everything from site1.exeample.com/shopping. This works, but when I go to http://site1.example.com/shopping/product/Bridgestone-E6-Orange-Golf-Balls-12-Pack-2011.html it's returned as:
http://www.example.com/shopping/product/Bridgestone-E6-Orange-Golf-Balls-12-Pack-2011.html?q=Bridgestone-E6-Orange-Golf-Balls-12-Pack-2011&rewrite=1 . Although it works, it doesn't look clean anymore... (the original URL doesn't contain the ?q=blabla&rewrite=1...).
My .htaccess in the root of my site looks like this:
RewriteEngine On
RewriteCond %{HTTP_HOST} site1\.example\.com$
RewriteRule (.*) http://www.site1.com/$1 [R=301,NC,L]
Options -MultiViews
RewriteEngine On
RewriteBase /shopping/
RewriteRule ^product/(.*).html$ products.php?q=$1&rewrite=1&%{QUERY_STRING} [L]
Can you help me get the rewritten URL clean? I'm not a star in .htaccess files, but maybe there's a work-around?
Cheers,
Koen
Hi David,
I'm getting an infinite loop when I use this rule. Do you know if there's a way to make it conditional?
Hi Koen,
It's important that the destination host is different the host containing this .htaccess in /shopping/ - but I think having re-read your original post it should be redirecting to the top level of your other site; e.g.
RewriteRule (.*) http://www.site1.com/$1 [R=301,L]
...so the above would be site.example.com/shopping/ which then redirects to www.site1.com - and therefore won't cause the infinite loop...
Cheers,
David.
--
PriceTapestry.com
Hi Koen,
It's probably best to take care of the redirection entirely within /shopping/.htaccess rather than in the top level .htaccess of www.example.com - have a go with:
Options -MultiViews
RewriteEngine On
RewriteBase /shopping/
RewriteRule (.*) http://www.site1.com/shopping/$1 [R=301,L]
Hope this helps!
Cheers,
David.
--
PriceTapestry.com