Hi,
Discovered a weird issue with one of my Drupal 7 sites today.
I am using the default .htaccess rewrite rule to redirect from example.com to www.example.com and it works just fine.
Now though I have discovered that google has some SEPRs for the site to www.ww.example.com. They work just fine and the page opens, but it also means the visitor gets stuck with www.ww.example.com for every internal link on the whole site.
How can I catch this in the .htaccess rewrite rule?
Thanks, /thomas
On 20 Jan 2012, at 4:19 PM, Thomas Svenson wrote:
Hi,
Discovered a weird issue with one of my Drupal 7 sites today.
I am using the default .htaccess rewrite rule to redirect from example.com to www.example.com and it works just fine.
Now though I have discovered that google has some SEPRs for the site to www.ww.example.com. They work just fine and the page opens, but it also means the visitor gets stuck with www.ww.example.com for every internal link on the whole site.
How can I catch this in the .htaccess rewrite rule?
RewriteCond %{HTTP_HOST} ^example.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^www.ww.example.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
Yeah, ended up putting the Drupal 6 .htaccess rules back.
The cause of this problem is the change to the .htaccess that was made for Drupal 7. I understand the reason for the change as they work when you have a multisite installation, then hard coded domains would not work. However, it also created this problem.
I have filed http://drupal.org/node/1411602 for Drupal Core so it hopefully can be fixed in a future point release.
/thomas
Thomas Svenson My Blog http://www.tsvenson.com | Twitter http://www.twitter.com/tsvenson | Google+ http://gplus.to/tsvenson
On 20/01/2012 16:04, Jeff Brown wrote:
On 20 Jan 2012, at 4:19 PM, Thomas Svenson wrote:
Hi,
Discovered a weird issue with one of my Drupal 7 sites today.
I am using the default .htaccess rewrite rule to redirect from example.com to www.example.com and it works just fine.
Now though I have discovered that google has some SEPRs for the site to www.ww.example.com. They work just fine and the page opens, but it also means the visitor gets stuck with www.ww.example.com for every internal link on the whole site. How can I catch this in the .htaccess rewrite rule?
RewriteCond %{HTTP_HOST} ^example.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^www.ww.example.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]