301使用多个空格重定向

时间:2015-02-01 15:50:29

标签: .htaccess redirect

我有一些如下链接:

http://mysite.ltd/content/store/tag/business card
http://mysite.ltd/content/store/tag/new business card
http://mysite.ltd/content/store/tag/new red card 3

现在我希望301将这些链接重定向到:

http://mysite.ltd/content/store/tag/business-card
http://mysite.ltd/content/store/tag/new-business-card
http://mysite.ltd/content/store/tag/new-red-card-3

所以我试试这段代码:

Options +FollowSymlinks -MultiViews
RewriteEngine on
RewriteBase /
RewriteRule ^([^\s%20]*)[\s%20]+(.*)$ $1-$2 [E=NOSPACE:1]
RewriteCond %{ENV:NOSPACE} =1
RewriteRule ^([^\s%20]+)$ $1 [R=301,L]

来自here。但URL重定向到此链接:

http://mysite.ltd/tag/new%20business%20card/?%1-%2

这段代码出了什么问题?

0 个答案:

没有答案