![](/img/trans.png)
[英]Redirect old website with parameters to new website with parameters under the same domain
[英]Redirect to New Website
我在根目录下创建了两个文件夹“ oldwebsite”和“ newwebsite”。
假设网域是www.example.com
如果有人访问www.example.com
,则必须转到根文件夹的索引,否则,如果有人访问www.example.com/newwebsite
,则必须转到文件夹newwebsite
,否则所有其他人都必须转到www.example.com/oldwebsite
请让我知道如何使用htaccess或php从根目录重定向。
旧网站www.example.com
如果在谷歌显示www.example.com/forum1
新网站www.folder1.example.com
另一种方法是在根目录中创建index.php:
<?php
header("Location: /newwebsite/");
?>
您可以在根文件夹本身的.htaccess文件中尝试此操作。
DirectoryIndex index.html
Redirect /newwebsite http://www.example.com/newwebsite/index.html
Redirect /oldwebsite http://www.example.com/oldwebsite/index.html
尝试这个
php有标题,并重定向到页面导航。
<?php
header("Location: www.example.com/newwebsite/");
//or
Redirect('http://www.example.com/newwebsite');
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.