简体   繁体   中英

Redirect to New Website

I made two folders in root called "oldwebsite" and "newwebsite".

Suppose domain is www.example.com

If someone goes to www.example.com it has to go to index on the root folder, else if someone goes to www.example.com/newwebsite it has to go to folder newwebsite , else all other has to go to www.example.com/oldwebsite

Please let me know how to redirect from root either using htaccess or php.

old website www.example.com

if in google shows www.example.com/forum1
new website www.folder1.example.com

Another method of doing this is creating an index.php in your root directory:

<?php
header("Location: /newwebsite/");
?>

You can try this in .htaccess file in the root folder itself.

DirectoryIndex index.html
Redirect /newwebsite http://www.example.com/newwebsite/index.html
Redirect /oldwebsite http://www.example.com/oldwebsite/index.html

Try this
php have header and redirect to page navaigate.

<?php

header("Location: www.example.com/newwebsite/");

//or


Redirect('http://www.example.com/newwebsite');
?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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