我有一个小问题,我需要用Htaccess替换URL中的所有字符期望字母和数字
示例
MP3 /尼古拉斯-Tremulis-(ASCAP)-100% - 心痛... /
我想要
MP3 /尼古拉斯-Tremulis-ASCAP-100-心痛/
我在网站管理员中收到了400多个错误
RewriteRule ^ search / node /(.*)$ custom-search& searchterms = $ 1 [NC,L]
答案 0 :(得分:0)
您可以在根.htaccess中使用此递归规则:
RewriteEngine On
RewriteBase /
# executes when there are more than 1 % in URI
RewriteRule "^([^%]*)%+([^%]*%.*)$" $1$2 [N,NE]
# executes when there is exactly 1 % in URI
RewriteRule "^([^%]*)%([^%]*)$" $1$2 [L,R=302,NE]