簡體   English   中英

重定向到新網站

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM