是不是可以同时使用两个htaccess代码?

时间:2013-10-22 17:47:19

标签: .htaccess

我在免费网络托管上托管了一个网站 它真的搞砸了我的想法我把两个代码放在htaccess文件中,用于404重定向 和其他用于删除.html扩展名

在谷歌浏览器中,只有一个文件被重定向到index.html [我有三个总共的文件] 并在Firefox中没有文件被重定向显示错误,并在主机网站上重定向 当我把www.example.com/hello 它工作正常 但是当我把www.example.com/hello.html 它不会在索引页面上重定向 如果我键入不正确的单词,它不会在index.html上重定向,也会发生同样的情况 当我删除第二个代码(html扩展卸妆),所以404重定向代码工作正常 为什么??是什么原因?是不是可以在htaccess文件中添加2个代码来收集?

这是htaccess的代码 -

    # Do not remove this line, otherwise mod_rewrite rules will stop working
RewriteBase /
ErrorDocument 404 /index.html
RewriteEngine on
RewriteBase /
RewriteCond %{http://www.example.com/new} !(\.[^./]+)$
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule (.*) /$1.html [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+)\.html\ HTTP
RewriteRule ^([^.]+)\.html$ http://www.example.com/new/$1 [R=301,L]

0 个答案:

没有答案
相关问题