【发布时间】:2020-12-04 03:01:24
【问题描述】:
最近,我尝试将 htaccess 用于我的语义清理器 url。这是我的代码
Options +MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^product/([0-9]+)$ home.php?id=$1 [NC]
当我导航到 http://localhost/home.php?id=1 时,它会返回正确的内容,但是当我转到 http://localhost/products/1 时,它会返回 404 not found 错误。
我尝试了这个问题:htaccess rewrite returns 404 not found 和 htaccess problem 404 not found 但没有任何效果
【问题讨论】:
-
尝试在第一行禁用多视图
Options -Multiviews将+更改为- -
仍然遇到同样的问题
标签: php apache .htaccess mod-rewrite