2011-02-17 11 views
0

私のURLは、このhtaccessを

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 

私のhtaccessのは簡単です

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

答えて

1

置換は、実際に、既存のファイル参照するかどうかをチェックする必要があります

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME}.php -f 
RewriteRule ^(.*)$ $1.php 

は、そうでなければ、あなたが最後に.phpを追加し、無限再帰を取得しますが毎回。