Page 1 of 1

Redirection rather that reuploading site

Posted: Mon Sep 27, 2010 11:44 am
by Bill H
I have a client for whom I do ongoing "back end" MIS work, and had done a website that was admittedly not all that great. I am a database guy, not a web designer, and had been urging him to contract with a design type to get the client side redone in a more attractive and marketing-oriented manner. He finally did, and it has not been going all that well. The guy put something together with WordPress and, beyond the manipulations provided by that platform, does not really have much of a clue as to how to do anything.

He's been doing the development in a subdirectory of the site ("new") and testing by going to http://www.mainsite.com/new/ (not a real link, so don't click on it). I observed that he had links in his development that were http://www.mainsite.com/new/whatever/page.php instead of ../whatever/page.php, that is to say, absolute rather than relative, and commented to my client that that might create problems when he tried to move it. It had already created problems when he moved it, for reasons that I never figured out, from "test" directory to "new" directory.

He "went live" over the weekend, but instead of moving the new files to the root directory, he simply put

Code: Select all

header('Location: http://www.mainsite.com/new/'); 
as the first line in index.php in the root directory. He told the client that doing it by moving the files would require 48-72 hours for the new site to "go live" which I told my client was absolute nonsense.

I have login traps througout the site which are,

Code: Select all

if (!isset($_SESSION['regownr']))
{     header("Location:../../index.php");
      exit;                                  // kick them back to main page
}

Which will result in a double redirect. Is that going to be a problem? In other cases the redirect is not to index.php, but is to cportal.php which is definitely a problem. I can put a redirect in that one as well, but how big of an issue is this whole thing, with the actual site not being in the "public root directory" but in a subdirectory with redirection?

Re: Redirection rather that reuploading site

Posted: Mon Sep 27, 2010 12:30 pm
by John Cartwright
*troutslaps that designer*

I can't believe people develop non blog websites around Wordpress. Anyways..

Besides each redirect taking an additonal HTTP request/response, it's generally not a problem. I believe the maximum number of redirects browsers will accept these days is 10.

Re: Redirection rather that reuploading site

Posted: Mon Sep 27, 2010 12:50 pm
by Bill H
Thanks. One problem I came up with is that anyone who bookmarked any page of the website other than the "home" page will not get the new site, but will get the old site instead. That would include clients who bookmarked the client login page.

Re: Redirection rather that reuploading site

Posted: Mon Sep 27, 2010 12:57 pm
by John Cartwright
Bill H wrote:Thanks. One problem I came up with is that anyone who bookmarked any page of the website other than the "home" page will not get the new site, but will get the old site instead. That would include clients who bookmarked the client login page.
True. I assume this was all a temporary fix until he goes back and removes all the references to /new/ ... which is simply silly.

Re: Redirection rather that reuploading site

Posted: Mon Sep 27, 2010 1:52 pm
by Bill H
No, unfortunately, this was intended as the permanent installation. He defends the absolute link as "the best performance" manner of linking, and seems to think there is some advantage to not removing the obsolete site files.

As a sample of his expertise, he uses a blank image for spacing between elements on a form because he seems not to know about the "margin" thing.

Re: Redirection rather that reuploading site

Posted: Tue Sep 28, 2010 1:24 am
by Benjamin
Changing the links can be done with a simple find and replace. You will also need to update a few items in the WP sitemeta table. Try finding them with a query such as:

Code: Select all

SELECT * FROM wp_sitemeta WHERE meta_value LIKE '%domain.com%';
You can then move the install into the root web directory.

Leaving the site in its current state is not acceptable.

Re: Redirection rather that reuploading site

Posted: Tue Sep 28, 2010 8:53 am
by Bill H
Doesn't seem to be a wp_sitemeta tabel in the database.

I cruised the database using phpmyadmin and didn't see any references to links other than some to wordpress.org. What are those?

Anyway, looks like a quick "find in files" and I'll be good to go. Thanks for the input, folks, I had pretty much decided it had to be changed.