我帮助客户迁移这在网页地址的末端到正确命名的URL结构中使用.html扩展名的旧网站。我想对所有以.html结尾的网址进行重定向至主页。的.htaccess重定向流量创下的.html链接TLD主页
我试过,但没有奏效:
RewriteRule ^(.*)\.html$ $1http://domain.org [NC]
我帮助客户迁移这在网页地址的末端到正确命名的URL结构中使用.html扩展名的旧网站。我想对所有以.html结尾的网址进行重定向至主页。的.htaccess重定向流量创下的.html链接TLD主页
我试过,但没有奏效:
RewriteRule ^(.*)\.html$ $1http://domain.org [NC]
像这样的东西应该适合你的需要:
RewriteEngine On
RewriteBase/
RewriteRule (.*)\.html$/[QSA,R=301,NC,L]
您可以使用sometihing这样的:
RewriteEngine On
RewriteBase/
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ([^/]+)\.html$ index.php?page=$1 [L,NC]
或永久重定向
RewriteEngine On
RewriteBase/
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule (.*)\.html$/[R=301,NC,L]
我会添加一个主页的情况 – EscoMaji 2012-02-29 13:15:15
你的问题不是很清楚,但只是根据你的代码,我认为这会为你工作:
RewriteRule \.html$ http://domain.org/? [R,L,NC]
这将.html
到http://domain.org/
即使剔除任何查询参数在原来的结尾的网址重定向URI。
是在同一个域中的文件(domain.org)? – 2012-02-29 00:52:25