开发者

.htaccess for displaying the .html files

I have three files in a folder 'test'

one.php
two.php
print.html

And i have .htaccess file in the same folder

RewriteEngine On
RewriteBase /test/
RewriteRule ^(.+)\.html$ $1\.php [L]

if we take the print.html in browser , there will be error , because of .htaccess file, for there is开发者_C百科 no 'print.php' page

How can we solve it , by modifing the .htaccess file. So that while taking the print.html, it should display in the browser


Try this.

RewriteEngine On
RewriteBase /test/
#If the request is for a file that exists already on the server, the "$1\.php" rule isn't served. 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)\.html$ $1\.php [L]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜