.htaccess 本地主机帮助中的htaccess

.htaccess 本地主机帮助中的htaccess,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,我的url是这样的 localhost/luz/home -> read home.php file localhost/luz/content/about -> read content.php?page=about 但不知何故,它并不完全起作用 localhost/luz/home -> SUCCESS localhost/contenttt -> internal server error (contenttt.php doesn't exist and the

我的url是这样的

localhost/luz/home -> read home.php file
localhost/luz/content/about -> read content.php?page=about
但不知何故,它并不完全起作用

localhost/luz/home -> SUCCESS
localhost/contenttt -> internal server error (contenttt.php doesn't exist and the 404 doesn't work)
localhost/content/about -> somehow it loads content.php?page=about.php/about
我的访问很简单

RewriteCond %{SCRIPT_FILENAME} !-d  
RewriteCond %{SCRIPT_FILENAME} !-f  
RewriteRule ^(.*)$ $1.php
RewriteRule ^content/(.*)$  content.php?page=$1
ErrorDocument 404 /404.php

您应该检查替换是否实际引用了现有文件:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php
否则,您将得到一个无限递归,每次在末尾添加
.php