【发布时间】:2012-01-23 14:11:09
【问题描述】:
我目前正在将网站(商店)移动到新域,并在其位置放置该网站的非商店版本(用 wordpress 制作)。目的是让大多数 url 重定向到新域,除了新站点的少数页面。我在 stackoverflow 上找到了其他帖子,但不幸的是我似乎无法让它工作。任何帮助将不胜感激,谢谢 Jason。
我需要排除的网址是: / (主页) /news 及其帖子 /news/post-name /products 及其帖子 /products/post-name /offers 及其帖子 /offers/post-name /我们的理念 /我们的队伍 /我们的梦想
这是我尝试过的:
<IfModule mod_rewrite.c>
RewriteEngine on
#Home
RewriteCond %{REQUEST_URI} !^/
#News
RewriteCond %{REQUEST_URI} !^/news(.*)
#Products
RewriteCond %{REQUEST_URI} !^/products(.*)
#Offers
RewriteCond %{REQUEST_URI} !^/offers(.*)
#Philosophy
RewriteCond %{REQUEST_URI} !^/our-philosophy(.*)
#Team
RewriteCond %{REQUEST_URI} !^/our-team(.*)
#Dream
RewriteCond %{REQUEST_URI} !^/our-dream(.*)
RewriteRule (.*) http://www.cotswold-fayre.co.uk/$1 [R=301,L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
【问题讨论】:
-
这应该是服务器故障,与编程无关..
标签: .htaccess mod-rewrite redirect url-rewriting http-status-code-301