2
我需要排除.xml站點地圖以添加尾部斜槓規則的幫助。如何從下列.htaccess重寫規則中排除特定文件類型
這裏的htaccess的代碼
<IfModule mod_rewrite.c>
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase/
#www to non
RewriteCond %{HTTP_HOST} ^www\.(([a-z0-9_]+\.)?ghadaalsaman\.com)$ [NC]
RewriteRule ^(.+?)/?$ http://%1/$1/ [R=301,L]
RewriteCond %{THE_REQUEST} \s/+(.+?)\.html/?[\s?] [NC]
RewriteRule^/%1/ [R=301,NE,L]
#index redirect
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ http://%{HTTP_HOST}/ [R=301,L]
# add a trailing slash to non files
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*?[^/])$ %{REQUEST_URI}/ [L,R=301]
# add html internally
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.]+)/$ $1.html [L]
</IfModule>
感謝@anubhava您的幫助
試試這個規則重寫規則^ $的sitemap.xml /索引解決了它.html?sitemap = 1 [L]將其添加到#www到非 – error2007s
同樣的問題,謝謝你的嘗試 –