简体   繁体   English

重命名索引页后如何将用户重定向到新网页?

[英]How to redirect the user to new webpage after renaming the index page?

I am developing a new website.Old name of my website was home.html now i changed it to index.php. 我正在开发一个新网站。我的网站旧名称是home.html,现在将其更改为index.php。 when i open the website it is moving to home.html not to index.php. 当我打开网站时,它移到home.html而不是index.php。 how to solve this problem? 如何解决这个问题呢? can anyone help me? 谁能帮我?

<meta http-equiv="refresh" content="0; url=http://yoursite.com/index.php"> 

index.php or index.html should be the default files loaded by your server when visiting a site, not home.html. index.php或index.html 应该是服务器访问站点时加载的默认文件,而不是home.html。 Try clearing your cache. 尝试清除缓存。 If that doesn't help it could be an issue in httpd.conf - but that sounds kind of extreme in this scenario. 如果那没有帮助,可能是httpd.conf中的问题-但这在这种情况下听起来很极端。

You can also look into using mod_rewrite in your .htaccess file so the redirect happens at the server level 您还可以研究在.htaccess文件中使用mod_rewrite,以便重定向发生在服务器级别

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

# redirect home.html to index.php
RewriteRule ^home.html index.php [R=301,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM