好的,我有这些旧的URL:
http://www.example.com/services.html
http://www.example.com/about.html
我想将所有包含.html的传入请求重定向到该网站的主页http://www.example.com.请记住,"旧"域名和"新"域名实际上是相同的,即example.com
我试过了,但htaccess规则不是我最强的一面:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} .html$
RewriteRule http://www.example.com [L,R=301]
用以下规则替换您的规则:
RewriteEngine On
RewriteRule .html$ /? [L,R=301,NC]