我在网站的根目录中有一个.htaccess文件,看起来像这样
RewriteRule ^some-blog-post-title/ http://website/read/flowers/a-new-title-for-this-post/ [R=301,L]
RewriteRule ^some-blog-post-title2/ http://website/read/flowers/a-new-title-for-this-post2/ [R=301,L]
<IfModule mod_rewrite.c>
RewriteEngine On
## Redirects for all pages except for files in wp-content to website/read
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !/wp-content
RewriteRule ^(.*)$ http://website/read/$1 [L,QSA]
#RewriteRule ^http://website/read [R=301,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
到目前为止,条件1和3正在实现。我怎样才能满足条件2?
注意:我想重定向到/read
,即使是为防止任何图片,CSS或javascript工作而存在的内容,/wp-content
答案 0 :(得分:1)
将您的第一条规则设为:
## Redirects for all pages except for files in wp-content to website/read
RewriteRule !^wp-content/ http://website.com/read%{REQUEST_URI} [NC,L,R=302]