开发者

.htaccess for displaying the .html files

开发者 https://www.devze.com 2022-12-25 18:10 出处:网络
I havethree files in a folder \'test\' one.php two.php print.html And i have .htaccess filein the same folder

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

精彩评论

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