Re: Cost of redirect and site domain switch? Good Practice / Bad Practice / Terrible Practice
| From: | Daniel Brown | Date: | Fri, 17 Aug 2012 20:38:33 +0000 |
| Subject: | Re: Cost of redirect and site domain switch? Good Practice / Bad Practice / Terrible Practice | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-318746@lists.php.net to get a copy of this message | ||
On Fri, Aug 17, 2012 at 4:30 PM, Tristan <sunnrunner@gmail.com> wrote:
>
> My colleague is saying
>
> "but I still think we should change all the references to someolddomain.com
> to some newdomain, especially in the code base, database etc..."
>
> I don't want to introduce more problems if a find/replace doesn't go right.
> Is there any valid reason for doing the quoted above or any argument against
> doing that.
If you have the luxury of time and resources, your colleague is
absolutely correct. In fact, now might be the ideal time to convert
all hard-coded values to a variable or definition that need only be
changed once should this recur.
Either way, the find/replace should definitely be done. Should
anything happen to the original domain - expiration, transfer, or even
a temporary DNS routing issue - you're screwed. You can't 301 from
something that isn't there in the first place (though, for good
measure, you can 301 *to* anything you'd like). From Linux, it's
simple to write a 'for' loop to find, cat, and sed everything in the
*.php, *.inc, *.html, etc. files, and database options are even
easier. That said, of course, make sure you've got everything backed
up just before you change the stuff, should things go awry --- and
without a current backup, you can bet your ass they will. Murphy's
Law.
--
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/