我遇到了将单个pdf文件重定向到新位置的麻烦。
RewriteEngine On
RewriteBase /
#REDIRECT QR CODE LINKS TO A NEW SOURCE
RedirectMatch 301 http://www.sampledomain.eu/assets/fm/download/en-gb/Technical%20documentation/General%20information/Substrates%20table%20Sample.pdf http://www.sampledomain.eu/assets/fm/download/en-gb/Technical%20documentation/Information/01_General%20information/02_Substrates%20table%20Sample.pdf
请注意,网址中有空格
我也尝试了这个没有成功:
#REDIRECT QR CODE LINKS TO A NEW SOURCE
RedirectMatch 301 ^/assets/fm/download/en-gb/Technical%20documentation/General%20information/Substrates%20table%20Sample.pdf$ http://www.sampledomain.eu/assets/fm/download/en-gb/Technical%20documentation/Information/01_General%20information/02_Substrates%20table%20Sample.pdf
我怎样才能让它发挥作用?
答案 0 :(得分:1)
%20
解码为空格字符。
将此规则与正确的正则表达式一起使用:
RedirectMatch 301 "^/assets/fm/download/en-gb/Technical documentation/General information/Substrates table Sample.pdf$" http://www.sampledomain.eu/assets/fm/download/en-gb/Technical%20documentation/Information/01_General%20information/02_Substrates%20table%20Sample.pdf