[英]How to rewrite url with . in the path?
I have a site (asp.net), somehow the google thinks it has url like this: 我有一个网站(asp.net),谷歌以某种方式认为它具有如下网址:
http://www.example.com/IL/Venice/Industrial-Warehouse-Space/1226-Bissell-Ave./709265
the actual url should be 实际网址应为
http://www.example.com/IL/Venice/Industrial-Warehouse-Space/1226-Bissell-Ave/709265
or http://www.example.com/property.aspx?id=709265 或http://www.example.com/property.aspx?id=709265
How to rewrite it? 怎么改呢?
I tried several software to rewrite this, ie ISAPI_Rewrite3.0, 我尝试了几种软件来重写它,即ISAPI_Rewrite3.0,
#RewriteRule /[a-zA-Z][a-zA-Z]/[a-zA-Z0-9\-/,.`')(&_@%\.]+./([0-9]+) /Property.aspx?ID=$1 [L]
However, it did not work. 但是,它没有用。 It returns a 404. Although the customError is setup, but never hit it.
它返回404。尽管customError已设置,但从未命中它。
It almost looks like before the asp.net process it, it returns 404. 看起来几乎像在asp.net处理它之前一样,它返回404。
These are two questions (and rules), I think. 我认为,这是两个问题(和规则)。 One is to redirect the first URL (with
.
) to the second ( without .
). 一个是重定向第一URL(同
.
)向第二( 没有 .
)。
RewriteRule ^(../.+?)\.(/[^/]+)$ /$1$2 [R,L]
The other is to rewrite from a request URI to your ASP script. 另一种是将请求URI重写为ASP脚本。
The rewrite rule has several problems 重写规则有几个问题
.
.
in front of the last slash, which is neither necessary nor helpful ID
is uppercase, this may or may not be a problem ID
为大写,这可能是问题,也可能不是问题 If you just want to pick up the trailing number as an id for your script, and don't really care about the format of your URL, you may try to capture it with this rule 如果您只想将尾随编号作为脚本的ID,并且不十分在意URL的格式,则可以尝试使用此规则捕获它
RewriteRule ^.+?/([0-9]+)$ /property.aspx?id=$1 [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.