我使用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
答案 0 :(得分:0)
尝试...
RewriteRule ^cpis_image/(.*)/$ ?cpis_image=$1 [R=301]