问题
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