重写逃脱主题标签#23% [英] Rewrite escaped hashtag # %23
问题描述
最近,我注意到一些进入404错误从URL中击中他们的#标签逃脱。
正确网址结构: http://example.org/#!/thepage
或 /index.html#!/拖到绘图页
转义/不正确的URL: http://example.org/%23!/thepage
我试过,但收效甚微以下的.htaccess的规则:
RewriteEngine叙述上
重写规则^%23!/(。*)$ /index.html#!/$1 [东北]
由于这个答案而我指出正确的方向:<一href=\"http://webmasters.stackexchange.com/a/76059\">http://webmasters.stackexchange.com/a/76059
下面是为我工作规则
重写规则^ \\ X23!/(。*)$ http://www.example.org/index.html#!/$1 [L,R = 301,NE]
在使用 \\ X
它将匹配转义字符开头%
I recently noticed some incoming 404 error hits from URLs with their hashtag escaped.
Correct URL structure:
http://example.org/#!/thepage
or /index.html#!/thepage
Escaped/ Incorrect URL:
http://example.org/%23!/thepage
I tried the following .htaccess rule with little success:
RewriteEngine on
RewriteRule ^%23!/(.*)$ /index.html#!/$1 [NE]
Thanks to this answer which pointed me into the right direction: http://webmasters.stackexchange.com/a/76059
Here is the rule that worked for me
RewriteRule ^\x23!/(.*)$ http://www.example.org/index.html#!/$1 [L,R=301,NE]
When using \x
it will match escaped characters starting with %
这篇关于重写逃脱主题标签#23%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!