为什么这个.htaccess重写规则不起作用?

时间:2015-04-23 11:36:01

标签: .htaccess mod-rewrite

我使用Wordpress插件,更新已将链接图像页面的URL路径从?cpis_image = name_of_image更改为/ cpis_image / name_of_image。

我将此行添加到我的.htaccess(我已经检查过了)

RewriteRule ^/cpis_image/(.*)/$ ?cpis_image=$1 [R=301]

但它不会重写新网址

测试网址

http://fionascottwilson.co.uk/cpis_image/wood-mouse-with-rasberries/

不会成为

http://fionascottwilson.co.uk/?cpis_image=wood-mouse-with-rasberries
  • 如果确实如此 - 更新后一切都会再次发挥作用。

看不出正则表达式有什么问题?

.htaccess的整个Wordpress部分

# BEGIN WordPress
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^/cpis_image/(.*)$ ?cpis_image=$1 [R=301]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

1 个答案:

答案 0 :(得分:0)

尝试...

RewriteRule ^cpis_image/(.*)/$ ?cpis_image=$1 [R=301]