htaccess redirect a plus sign

女生的网名这么多〃 提交于 2019-12-24 12:26:37

问题


I try to make a redirect of a URL from my old site to my new site, but it does not work. I think that the plus symbol is giving me problems.

  RewriteRule ^nl/pageid/junair+compressor+onderhoud(|/)$     /nl/persluchttechniek/page/nieuwsberichten/compressor-onderhoud-junair  [R=301,L]

回答1:


Try this redirect rule in your root .htaccess of old site:

RewriteRule ^nl/pageid/junair[\s+]compressor[\s+]onderhoud/?$ /nl/persluchttechniek/page/nieuwsberichten/compressor-onderhoud-junair [NC,B<R=301,L]

Make sure this is your very first rule below RewriteEngine line. Also check there is no other .htaccess in your system.




回答2:


The + is presumably a URL encoded space, try replacing it in the pattern with a \s.

RewriteRule ^nl/pageid/junair\scompressor\sonderhoud(|/)$     /nl/persluchttechniek/page/nieuwsberichten/compressor-onderhoud-junair  [R=301,L]


来源:https://stackoverflow.com/questions/27016789/htaccess-redirect-a-plus-sign

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!