删除带有.htaccess的.html会导致404错误
所以我刚刚想出了如何制作自己的自定义404页面,404页面现在就可以工作了。 我为404页面做了所有的.htaccess内容,但现在我正试图从url中删除.html。 我输入了从互联网上找到的代码,我相信它是有效的,因为现在.html已经不存在了,但是我得到了一个404错误页面。e、 x domain.com/contact显示我的404错误删除带有.htaccess的.html会导致404错误,html,.htaccess,ftp,Html,.htaccess,Ftp,所以我刚刚想出了如何制作自己的自定义404页面,404页面现在就可以工作了。 我为404页面做了所有的.htaccess内容,但现在我正试图从url中删除.html。 我输入了从互联网上找到的代码,我相信它是有效的,因为现在.html已经不存在了,但是我得到了一个404错误页面。e、 x domain.com/contact显示我的404错误 RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FI
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /error_404.html
ErrorDocument 404 /error_404.html
RemoveType x-mapp-php4 .html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)$ $1.html [L,QSA]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\.html\ HTTP/
RewriteRule ^(.*)\.html$ /$1 [R=301,L]
“RewriteCond”开始的底部部分是删除.html的代码。尝试使用此选项
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule .* $0.html
RewriteRule (.*) /error_404.html
ErrorDocument 404 /error_404.html
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.html
RewriteRule ^/?(.*)\.html$ /$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^/?(.*)$ /$1.html [L]
</IfModule>
重新启动发动机
重写基/
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}\.html-f
重写规则。*$0.html
重写规则(.*)/error_404.html
ErrorDocument 404/error_404.html
重写cond%{u请求}^[A-Z]{3,9}\/([^\]+)\.html
重写规则^/?(.*)\.html$/$1[L,R=301]
重写cond%{REQUEST_FILENAME}\.html-f
重写规则^/?(.*)$/$1.html[L]
不,这只会让事情变得更糟啊哈哈哈哈哈哈哈现在我点击的所有内容都会导致一个404页面,而这个页面甚至不是我的…是的,而且我还添加了一些内容。删除类型x-mapp-php4.html-这将不再需要。这个页面仍然会加载错误页面,甚至加载没有.html扩展名的html。