我的.htaccess文件的顶部有这些规则。
第二个(客户故事)按预期工作,将所有请求重定向到domain.com/site/category/client-stories/
到domain.com/site/client-stories/
。第一个,conversations
不起作用。我以相反的顺序尝试了它们,首先是client-stories
,而client-stories
仍在工作,conversations
没有。
Redirect 301 /site/category/conversations/ /site/conversations/
Redirect 301 /site/category/client-stories/ /site/client-stories/
[更新为添加:]`/ site /中的.htaccess文件继续如下:
# BEGIN W3TC Browser Cache
<IfModule mod_deflate.c>
<IfModule mod_headers.c>
Header append Vary User-Agent env=!dont-vary
</IfModule>
AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
<IfModule mod_mime.c>
# DEFLATE by extension
AddOutputFilter DEFLATE js css htm html xml
</IfModule>
</IfModule>
# END W3TC Browser Cache
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /site/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /site/index.php [L]
</IfModule>
# END WordPress
#Expires Header
<IfModule mod_expires.c>
AddType image/x-icon .ico
ExpiresActive on
ExpiresByType image/jpeg A2592000
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/x-icon A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType text/css M604800
ExpiresDefault M604800
</IfModule>
# WP-AVOID-SLOW Begin
# ETags
FileETag none
# WP-AVOID-SLOW END
此外,还有一个根级.htaccess
:
rewriteengine on
rewritecond %{HTTP_HOST} ^www.secondary-domain.com$ [OR]
rewritecond %{HTTP_HOST} ^secondary-domain.com$
rewriterule ^ "http\:\/\/domain\.tv\/site" [R=301,L] #4f74d1ea4ff18
rewritecond %{HTTP_HOST} ^www.domain.tv$ [OR]
rewritecond %{HTTP_HOST} ^domain.tv$
rewriterule ^ "http\:\/\/domain\.tv\/site" [R=301,L] #4f74d152a5dd3
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteBase /
</IfModule>
# END WordPress
rewriterule ^index\.php$ - [L]
rewritecond %{REQUEST_FILENAME} !-f
rewritecond %{REQUEST_FILENAME} !-d
rewriterule . /index.php [L]