0

www.domain.com/index.php当我通过或访问我的网站时,出于 SEO 目的www.domain.com/index.html,它需要重定向到。www.domain.com

如何在 .htaccess 中配置它?

4

2 回答 2

0

通过启用 mod_rewrite 和 .htaccess httpd.conf,然后将此代码放在您.htaccessDOCUMENT_ROOT目录下:

DirectoryIndex index.html index.php

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On

RewriteRule ^index\.(html?|php)$ / [L,R=301,NC]
于 2013-07-25T07:13:18.593 回答
0
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /(index)|(home)(..{3,4})?$ [NC]
RewriteRule ^([^/]+/)+ http://www.example.com/$1? [R=301,L]
于 2013-07-25T06:53:00.253 回答