采用了大部分.htaccess的答案来删除.html扩展名,但仍然没有改变



我试图从我的网站的子页面删除。html扩展;papers.html。当我点击这些页面时,我希望它们不带。html。

这是我的。htaccess在这一刻的样子。全是能解决我问题的答案。为了给你一些背景,我正在从头开始开发这个网站,并使用filezilla作为我的FTP解决方案,以及dreamhost作为我的托管解决方案。我把。htaccess和index.html放在同一个文件夹里。

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*).html$ /$1 [L,R=301] 
######################################################################
RewriteRule /(.+)(.html)$ /$1 [R=301,L] 
######################################################################
RewriteEngine on
RewriteBase /
RewriteCond %{http://www.proofers.co.uk/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.proofers.co.uk/new/$1 [R=301,L]
######################################################################
#Section 1
RewriteEngine On
IndexIgnore *
Options +FollowSymLinks -Multiviews -Indexes
######################################################################
RewriteCond %{QUERY_STRING} base64_encode.*(.*) [OR]
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2})
RewriteRule ^(.*)$ index.php [F,L]
# Protect .htaccess
<Files .htaccess>
    order allow,deny
    deny from all
</Files>

Try with:

RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}s([^.]+).html[s?] [NC]
RewriteRule ^ %1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [L]

所有的html页面。

最新更新