我的.htaccess重定向代码出了什么问题



我觉得这很容易。我只是想通过添加到.htaccess文件来将一个页面(index.html(重定向到另一个页面上(index.php(,无论我做什么,原始文件(index.html(仍在显示。htaccess页面已经有覆盖SSL的代码。主机是NamesCo。

我现在拥有的代码:

# BEGIN SSL Redirect
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
RewriteRule ^index.html$ index.php [R=301,L] 
# END SSL Redirect

代码我也尝试过:

RedirectMatch 301 /index.html/ /index.php/
Redirect 301 /index.html / index.php/
Redirect 301 "index.html" "index.php"

I8显然做错了什么,但看不出是什么,所以目前我只能使用http刷新重定向,但我讨厌这样做。

有人能帮忙吗?

好的。经过更多的实验,我已经修复了它。我首先删除了现有的SSL重写代码,并使用了规范标记。然后.htaccess文件读取:

<IfModule mod_rewrite.c>
RewriteEngine On
Redirect 301 /index.html /index.php
Redirect 301 /aboutUs/about_us.htm /aboutUs/about_us.php
Redirect 301 /aboutUs/bookings.htm /aboutUs/bookings.php
Redirect 301 /aboutUs/maps.htm /aboutUs/maps.php
Redirect 301 /east_wing/bedroom.html /east_wing/bedroom.php
Redirect 301 /east_wing/lounge.html /east_wing/lounge.php
Redirect 301 /east_wing/ew_index.htm /east_wing/ew_index.php
Redirect 301 /east_wing/guestbook.html /east_wing/guestbook.php
Redirect 301 /fife/vivitor_attractions.htm /east_wing/visitor_attractions.php
</IfModule>

非常感谢

Tog:-(

最新更新