我正在开发一个新网站。我的网站的旧名称是home.html现在我将其更改为index.php。当我打开网站时,它会移动到主页.html而不是索引.php。如何解决这个问题?谁能帮我?
<meta http-equiv="refresh" content="0; url=http://yoursite.com/index.php">
index.php或index.html应该是服务器在访问站点时加载的默认文件,而不是home.html。尝试清除缓存。如果这没有帮助,这可能是httpd.conf中的一个问题 - 但在这种情况下听起来有点极端。
您还可以考虑在.htaccess文件中使用mod_rewrite,以便在服务器级别进行重定向
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
# redirect home.html to index.php
RewriteRule ^home.html index.php [R=301,L]