Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess htaccess具有空格和%20_.htaccess_Spaces - Fatal编程技术网

.htaccess htaccess具有空格和%20

.htaccess htaccess具有空格和%20,.htaccess,spaces,.htaccess,Spaces,我已经遍历了堆栈溢出并尝试了给出的每个答案,但无法解决我的问题。我重新设计了我的网站,并试图纠正404错误使用重定向301。以下是我尝试过的,但所有选项都失败了: 重定向301/wp content/themes/taketheleap/images/52周/high res/8V%20Beat%20Lehigh%20Mascot%20Greensboro%20North%20Carolina.jpg 重写规则^/wp content/themes/taketheleap/images/52周/

我已经遍历了堆栈溢出并尝试了给出的每个答案,但无法解决我的问题。我重新设计了我的网站,并试图纠正404错误使用重定向301。以下是我尝试过的,但所有选项都失败了:

重定向301/wp content/themes/taketheleap/images/52周/high res/8V%20Beat%20Lehigh%20Mascot%20Greensboro%20North%20Carolina.jpg

重写规则^/wp content/themes/taketheleap/images/52周/high res/8V Beat-Lehigh吉祥物格林斯伯勒北卡罗来纳州.jpg[R=301,东北]

我尝试过用%20s和空格重定向301,用%20s和空格重写规则。他们都失败了

我知道我遗漏了一些明显的东西,但不知道是什么。请提供帮助?

根据文档,我们看到重写规则与%解码版本匹配。因此,请为空格字符放置\s
^/wp content/themes/taketheleap/images/52周/high res/8V\sBeat\slehah\sMascot\sGreensboro\sNorth\sCarolina\.jpg
..

只需使用空格即可。我最近遇到了同样的问题。因此,如果您试图从或重定向到使用字符编码的url,只需使用字符即可

用途:东西 而不是:

找到了答案:

从本质上讲,这一点:将原始url加上引号并加上一个文本空格就解决了这个问题

因此,我的重定向现在是:


重定向301'/wp content/themes/taketheleap/images/52周/redux/high res/34罗马-维克多·埃曼纽尔二世无名战士纪念碑墓。jpg'

刚刚尝试,失败。具体来说,尝试了以下方法:RewriteEngine on RewriteRule^/wp content/themes/taketheleap/images/52week/high res/8V\sBeat\slehaigh\sMascot\sGreensboro\sNorth\sCarolina\.jpg[R=301]老实说,我无法告诉您为什么它不起作用。我猜你的重写规则没有得到正确的理解。你能举个例子吗?我尝试了这个,结果产生了500个错误,可能是因为它看到了太多的空格。我甚至尝试加入一个[NE]条款:RewriteRule^/wp content/themes/taketheleap/images/52week/redux/high res/34 Rome-Victor Emmanuel II无名战士纪念碑墓。jpg[NE,R=301]