301重定向有例外

时间:2015-11-27 01:12:02

标签: .htaccess redirect

我有以下htaccess设置,我的目的是bacchusbreak.com和www.bacchusbreak.com应该重定向到我的shopify网站,除了faq文件夹。

bacchusbreak.com/faq有效,但是,www.bacchusbreak.com / faq给出了404。 有什么想法吗? :)

RewriteOptions inherit
RewriteEngine on
RewriteCond %{HTTP_HOST} ^bacchusbreak\.com$ [NC]
RewriteCond %{HTTP_HOST} ^www\.bacchusbreak\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/faq/
RewriteRule ^(.*)$ "http\:\/\/wholesailors\.myshopify\.com\ \/" [R=301,L]

1 个答案:

答案 0 :(得分:0)

这应该有效:

RewriteOptions inherit
RewriteEngine on
# Combine the original two lines into one line, making "www." optional
RewriteCond %{HTTP_HOST} ^(www\.)?bacchusbreak\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/faq/
# No quotes needed around the destination URL
RewriteRule ^(.*)$ http://wholesailors.myshopify.com [R=301,L]