2016-07-25 14 views

回答

0

按照你的逻辑,你会在到达:

RewriteEngine on 
#If path ends in a forward slash, don't rewrite 
RewriteRule ^(.*)/$ - [L] 
#If path ends in .html, don't rewrite (avoiding an infinite loop) 
RewriteRule ^(.*)\.html$ - [L] 
#Otherwise add .html to the end (note this will apply to images too) 
RewriteRule ^(.*)$ $1.html 

但是,这会影响到其他的扩展,以及如图像。我建议检查文件是否存在或不是这样的:

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^(.*)$ $1.html 
+0

是的,我马上找到了images/css/jss没有加载! :-) –

相关问题