我正在与下面的htacces重定向进行斗争。有些工作,有些不工作,我无法弄清楚原因。
每个RewriteCond都在那里,因为这些重定向应该仅在主域中起作用而不是在我也有的子域中起作用
RewriteCond %{HTTP_HOST} !^www\.splendesco\.nl$ [NC]
RewriteRule ^workshop\-enneagram/(.*)$ /workshops\-en\-trainingen/workshop\-enneagram/$1 [R=301,NC] **this one works**
#
RewriteCond %{HTTP_HOST} !^www\.splendesco\.nl$ [NC]
RewriteRule ^workshops/(.*)$ /workshops\-en\-trainingen/$1 [R=301,NC] **this one works**
#
RewriteCond %{HTTP_HOST} !^www\.splendesco\.nl$ [NC]
RewriteRule ^workshop/(.*)$ /workshops\-en\-trainingen/$1 [R=301,NC] **this redirects to http://www.splendesco.nl/workshops-en-trainingen/workshop-enneagram/ which is not correct**
#
RewriteCond %{HTTP_HOST} !^www\.splendesco\.nl$ [NC]
RewriteRule ^trainingen/(.*)$ /workshops\-en\-trainingen/$1 [R=301,NC] **this one gives a 404 and does not redirect**
#
RewriteCond %{HTTP_HOST} !^www\.splendesco\.nl$ [NC]
RewriteRule ^training/(.*)$ /workshops\-en\-trainingen/$1 [R=301,NC,L] **this one gives a 404 and does not redirect**
修改 好。我根据以前的输入改变了一些东西。不幸的是,问题仍然存在: - (
RewriteCond %{HTTP_HOST} !^www\.splendesco\.nl$ [NC]
RewriteRule .? –[S=5]
RewriteRule ^/workshop\-enneagram/(.*)$ /workshops\-en\-trainingen/workshop\-enneagram/$1 [R=301,NC,L]
RewriteRule ^/workshops/(.*)$ /workshops\-en\-trainingen/$1 [R=301,NC,L]
RewriteRule ^/workshop/(.*)$ /workshops\-en\-trainingen/$1 [R=301,NC,L]
RewriteRule ^/trainingen/(.*)$ /workshops\-en\-trainingen/$1 [R=301,NC,L]
RewriteRule ^/training/(.*)$ /workshops\-en\-trainingen/$1 [R=301,NC,L]
顺便说一句:如果我用
Redirect 301 /training /workshops-en-trainingen/
一切都很好,重定向按预期工作,除了......重定向也会在子域上发生。