htaccess 重写规则在我的错误日志文件中显示错误
htaccess rewrite rules show an error in my error log file
我有一个依赖于 htaccess 重写规则的网站,我用这样的顺序重写了我的 URL:
www.example.com/games/car/play/123
实际上没有以下目录:
- 游戏
- 汽车
- 播放
每天我都看到我的错误日志显示大量错误行说:
File does not exist: /home/example.com/public_html/games
File does not exist: /home/example.com/public_html/car
File does not exist: /home/example.com/public_html/play
我不知道为什么 Apache 将这些假目录视为真正的真实目录?我的 htaccess 中有这些重写代码行:
RewriteEngine On
RewriteBase /
RewriteRule ^games/([a-zA-Z0-9-/]+)/play/(.*)$ details.php?slug=&id=
现在 Apache 考虑:games/slug/play/id 作为目录,它不仅仅是一个假的 URL 序列。另外,当我向下翻页时:
www.example.com/games/car
和
www.example.com/games
它已经作为 URL 存在,但不是目录我看到错误日志说:
File does not exist: /home/example.com/public_html/games/car
File does not exist: /home/example.com/public_html/games
我该如何解决这个问题?我已经尝试了所有可能的方法,但我的错误日志中仍然出现大量错误。
非常感谢(抱歉我的英语不好)。
尝试关闭 MultiViews 并添加一些条件检查。
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^games/([a-zA-Z0-9-/]+)/play/(.*)$ details.php?slug=&id= [L]
我有一个依赖于 htaccess 重写规则的网站,我用这样的顺序重写了我的 URL:
www.example.com/games/car/play/123
实际上没有以下目录:
- 游戏
- 汽车
- 播放
每天我都看到我的错误日志显示大量错误行说:
File does not exist: /home/example.com/public_html/games
File does not exist: /home/example.com/public_html/car
File does not exist: /home/example.com/public_html/play
我不知道为什么 Apache 将这些假目录视为真正的真实目录?我的 htaccess 中有这些重写代码行:
RewriteEngine On
RewriteBase /
RewriteRule ^games/([a-zA-Z0-9-/]+)/play/(.*)$ details.php?slug=&id=
现在 Apache 考虑:games/slug/play/id 作为目录,它不仅仅是一个假的 URL 序列。另外,当我向下翻页时:
www.example.com/games/car 和 www.example.com/games
它已经作为 URL 存在,但不是目录我看到错误日志说:
File does not exist: /home/example.com/public_html/games/car
File does not exist: /home/example.com/public_html/games
我该如何解决这个问题?我已经尝试了所有可能的方法,但我的错误日志中仍然出现大量错误。
非常感谢(抱歉我的英语不好)。
尝试关闭 MultiViews 并添加一些条件检查。
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^games/([a-zA-Z0-9-/]+)/play/(.*)$ details.php?slug=&id= [L]