htaccess & clean urls / not working after website moved to subdomain
i had to move a website to a new subdomain. previously it was available at www.some-domain.com
. it has now moved to http://shop.some-domain.com
.
there are only some bits of the website which actually use clean urls, for example: http://shop.some-domain.com/en-GB/shop/accessories/Soft-Scarf
and exactly those URLs do not work anymore, i receive an error 404 when trying to open them. other parts of the website which do not use clean urls work fine.
the website files are located in the root folder (/)... the htaccess inside this folder looks like this:
AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.some-domain.com [NC]
# i think this line is causing the problem:
RewriteRule ^(.*)$ http://www.some-开发者_开发技巧domain.com/$1 [R=301,L]
ErrorDocument 404 /webEdition/redirectSEOurls.php
tried changing the URL in the line to shop.some-domain.com but it didn't help
help is much appreciated, thanks
You're correct about the error source. Just change the two occurrences of www
to shop
.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^shop\.some-domain.com [NC]
RewriteRule ^(.*)$ http://shop.some-domain.com/$1 [R=301,L]
The purpose of the RewriteCond
line and subsequent RewriteRule
was to force requests like http://some-domain.com
to the canonical domain http://www.some-domain.com
. You've now changed that to shop.some-domain.com
and so it's a simple matter of updating both the condition and the rewrite rule.
精彩评论