Word Press: locally hosted uploaded to live, wants *.local

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Word Press: locally hosted uploaded to live, wants *.local

Post by simonmlewis »

Hi

This is an issue I have had the other way around, so maybe just a reminder is needed.

I've built a word press site for someone locally. ie. http://theirsite.local
I have uploaded the files and database to the live server, but all links, including just popping in /wp-admin redirects the user to ".local".

I'm sure it was code I put into wp-config.php. Something that overrides it doing that.

Any clues?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Word Press: locally hosted uploaded to live, wants *.loc

Post by Celauran »

Pop this into your wp-config.php

Code: Select all

define('WP_HOME', 'http://their.actual.url');
define('WP_SITEURL', 'http://their.actual.url');
Should sort you out.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Word Press: locally hosted uploaded to live, wants *.loc

Post by simonmlewis »

That's the one. Brilliant Thanks.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: Word Press: locally hosted uploaded to live, wants *.loc

Post by twinedev »

be sure to check for any post content that has links/images in them. Unless you do a S/R across the table or use a migrate plugin, while menus and such will be in the right place, content references will still be point to a full url of something like:

Code: Select all

<p>If you need more info, please <a href="http://theirsite.local/contact-us">contact-us</a>.</p>
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Word Press: locally hosted uploaded to live, wants *.loc

Post by simonmlewis »

Got a new issue related to this one.
We had a site all under Word Press in the root of the live area.
The client then decided to do a custom site in the root, and move the WP Blog over to a /blog folder.

I've moved it.
I've updated wp-config.php with the code you suggest, and the site loads. But anything under the site fails.

So for example: http://www.site.com/blog/hello-there
That goes to the index.php template in the root.
The htaccess file in the root is setup correctly. I am showing both HTACCESS files below:

Root:

Code: Select all

DirectoryIndex index.php index.html index.htm 
order allow,deny
allow from all

 RewriteEngine On
Options +FollowSymLinks
Options +Indexes

RewriteRule ^(blog)($|/) - [QSA]

RewriteRule ^([^/\.]+)/?$ index.php?page=$1 [L]
RewriteRule ^$ index.php [L]
Blog HTACCESS:

Code: Select all

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Word Press: locally hosted uploaded to live, wants *.loc

Post by Celauran »

Did you update WP_HOME and WP_SITEURL to reflect the new location?
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Word Press: locally hosted uploaded to live, wants *.loc

Post by simonmlewis »

No.... how?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Word Press: locally hosted uploaded to live, wants *.loc

Post by Celauran »

Look at the post earlier on. You set WP_HOME to whatever.co.uk. You then moved the site to whatever.co.uk/blog/
Post Reply