dci*_*iso 3 .htaccess mod-rewrite redirect url-rewriting http-status-code-301
我目前正在将一个站点(商店)移动到一个新域,并在其位置放置该站点的非商店版本(在 wordpress 中制作)。目的是让大多数 url 重定向到新域,除了新站点拥有的少数页面。我在 stackoverflow 上找到了其他帖子,但不幸的是我似乎无法让它工作。任何帮助将不胜感激,谢谢杰森。
我需要排除的网址是:/(主页)/news 及其帖子 /news/post-name /products 及其帖子 /products/post-name /offers 及其帖子 /offers/post-name /our-philosophy /我们的团队/我们的梦想
这是我尝试过的:
<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
Run Code Online (Sandbox Code Playgroud)
尝试将以下内容添加到您的 .htaccess 文件中
RewriteEngine on
#Home: Exclude the home Page
RewriteCond %{REQUEST_URI} !^/$ [OR]
#News: exclude anything that starts with /news, /products etc
RewriteCond %{REQUEST_URI} !^/(news|products|offers|our-philosophy|our-team|our-dream) [NC]
RewriteRule (.*) http://www.cotswold-fayre.co.uk/$1 [R=301,L]
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5418 次 |
最近记录: |