为什么htaccess没有在域名之后和变量之前添加“\”?

时间:2012-04-26 23:06:51

标签: .htaccess mod-rewrite

我正在使用.htaccess文件,我已经成功完成了几次重定向。 我遇到问题的一行是:

RedirectMatch 301 ^bookfox/(.*)/(.*)/(.*) http://www.thejohnfox.com/$3

我正在尝试使用此网址:http://thejohnfox.com/bookfox/2006/10/joyce_carol_oat
并将其转发到http://thejohnfox.com/joyce_carol_oat

我只能让RedirectMatch执行此操作: http://thejohnfox.comjoyce_carol_oat 我已经尝试了所有我能找到的东西,没有任何东西可行。

有人知道为什么在thejohnfox.com之后取出正斜杠?

这是我的Wordpress .htaccess文件中的完整代码:

# 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]

Redirect 301 /bookfox/bio.html http://thejohnfox.com/bio/
Redirect 301 /bookfox/journals-accepting-novellas.html http://thejohnfox.com/journals-accepting-novellas/
Redirect 301 /bookfox/ranking-of-literary-journ.html  http://thejohnfox.com/ranking-of-literary-journals/
Redirect 301 /bookfox/what-is-bookfox.html http://thejohnfox.com/what-is-bookfox/
Redirect 301 /bookfox/journals-accepting-electronic-submissions.html http://thejohnfox.com/journals-accepting-electronic-submissions/

RedirectMatch 301 ^(.*)\.html$ http://thejohnfox.com$1/
RedirectMatch 301 ^bookfox/(.*)/(.*)/(.*) http://www.thejohnfox.com/$3

</IfModule>

# END WordPress

0 个答案:

没有答案