我用下面的.htacess规则修改PHP文件扩展HTML:
I am using the following .htacess rules to modify the PHP file extensions to HTML:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.html
我的根放在.htacess文件以及两个PHP文件(page1.php中page2.php中将)。
I placed the .htacess file as well as two PHP files (page1.php and page2.php) in the root.
当我尝试访问使用HTML扩展,而不是(page1.html或page2.html)我得到的404错误信息,说明该页面的PHP文件无法找到。
When I try to access the PHP files using the html extension instead (page1.html or page2.html) I get the 404 error message stating the page cannot be found.
你能指引我正确的方向?
Could you please guide me to the right direction?
试试这个:
RewriteEngine on
RewriteRule ^(.*).html$ $1.php
当你将访问page1.html系统将查找:page1.php中
when you will access page1.html the system will look for: page1.php