我收到某些网址的 403 访问禁止错误。我找到了问题的根本原因。只要 url 中有点 (.),我就会收到 403 forbidden。
Google 已经索引了数以千计的网址,因此我想通过 htaccess 进行解析。
例如
我想删除以下网址的(点)
来自
http://www.example.com/zero/one/two/three/four/five/six./seven/eight.html
到
http://www.example.com/zero/one/two/three/four/five/six/seven/eight.html
最佳答案
mod rewrite 应该能够做到这一点:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([^.]*)\.([^.]*)\.?([^.]*)?\.?([^.]*)?\.?([^.]*)?(\.html|php|asp|otherextenstionsdesiredhere$) $1$2$3$4 [NC]
应允许一次删除 1 到 3 个经期。如果您需要更多,只需再重复一点。如果最多只有 1 个周期,则去掉一部分。 您可以在 http://regexpal.com/ 进行测试并阅读更多关于重写的信息 http://corz.org/serv/tricks/htaccess2.php
关于linux - 如何通过htaccess删除url中的点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12868378/