|
|
|
|
![]() ![]() |
Nov 7 2005, 02:54 PM
Post
#1
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 535 Joined: 14-February 05 From: Oslo, Norway Member No.: 3,759 |
Over a month ago, I bought a domain name for my site, but my site is still not indexed.
I did everything needed to get indexed, but I forgot one thing: The old site had exactly the same content as the new one. So I had duplicate content. Therefore, I want my old site to redirect the user to the new site with this script: CODE <?php header("Location: http://www.global-rs.com" . $_SERVER['REQUEST_URI']); exit; ?> global-rs.com is my new URL. However, on my old site, which I will be placing this code on, there is a problem: It was a free host, not trap17 (I already had another site hosted here when creating the other site). They didn't offer subdomain, it was just a directory: thehost.com/globalrs. The code shown above will redirect me to global-rs.com/globalrs/someurl But is there a way to remove globalrs/ from the redirection, so it will only redirect the user to global-rs.com/someurl? |
|
|
|
Nov 7 2005, 04:25 PM
Post
#2
|
|
|
Incest is a game the whole family can play. ![]() Group: [MODERATOR] Posts: 1,234 Joined: 11-February 05 From: Heaven Member No.: 3,709 myCENT:READY[115.88] |
Try this code:
CODE <? $thisuri = $_SERVER["REQUEST_URI"]; $noSubDir = str_replace("/global_rs", "/", $thisuri); header("location: http://globalrs.com" . $noSubDir); ?> $noSubDir uses php's str_replace function to replace all instances of /global_rs with /. Should work properly..... |
|
|
|
Nov 7 2005, 06:54 PM
Post
#3
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 535 Joined: 14-February 05 From: Oslo, Norway Member No.: 3,759 |
Thanks, but there were some errors with your code.
CODE <? $thisuri = $_SERVER["REQUEST_URI"]; $noSubDir = str_replace("/globalrs/", "/", $thisuri); header("location: http://global-rs.com" . $noSubDir); ?> This is how it should be. But anyway, thanks alot for the help! |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 22nd November 2008 - 05:22 PM |