Wordpress local server to live host - php

I am developing a wordpress site. I uploaded the files(wordpress) to my live host. So my new live url site for my wordpress like this sample url http://mywordpress.com/, the display seems to be fine, but when I start browsing the menus page will be redirected to my local server, instead of http://mywordpress.com/about-us/ it went to my localhost like http://localhost/mywordpress/about-us
So when I checked the page source all the links including the stylesheet is link to my local. even though I use this code
<link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" type="text/css" media="all" />
Its kinda weird... but anyone knows how to configure this?

It sounds to me like your database may be using old values for your url's.
For a quick solution that may or may not solve your issue, try http://www.velvetblues.com/web-development-blog/wordpress-plugin-update-urls/ . It's a great plugin. If not... here are my bullet proof instructions for transferring from local to online.
I've migrated from local to online hundreds of times and I think most tutorials on wordpress migration are overly complex. Here's my method (assuming you already have a fresh wordpress installation and database)
Go to phpMyAdmin for your local server and export your database (but not as a file)... just get the straight SQL text and copy it.
Paste that code into dreamweaver, text editor, coda or any plaintext word processor that can do a search and replace. Then search for "http://MyOldWordpressUrl.com/wordpress" (make sure there is NO slash after the final directory) and replace with "http://MyNewWordpressUrl.com/wordpress". Obviously don't include the quotation marks. Make sure your old wordpress URL is correct. You can double check in admin -> general settings.
Get into your control panel for your online hosting and go to the database for your new wordpress install (this should be a brand new installation where you haven't yet created any posts or input any data-- just what wordpress gives you). Export the database and save it as a file (just in case). Now drop all the tables. Click YES when it asks you if you're sure. Then click on the SQL icon (should be in the upper left hand corner of the left sidebar). This should open a new window. Now paste in your code from step 2 and click GO.
Transfer your theme folder via FTP.
Right now you should go to the new wordpress install's wp-admin. Your same User Name and password will apply. Go to "add a post" and add any image from your computer... wait for it to upload, now delete it. This step is to have the server create the uploads folder to be 100% certain is registered by wordpress and set to the correct permissions. I've wasted hours before by transferring the uploads folder directly by FTP, so don't do it.
Step 5 created an uploads folder in FTP, now you can drag and drop the contents of your uploads folder (ie 2008, 2009, 2010, 2011 + subfolders) into the uploads folder. There should be nothing in it except an empty folder (because you deleted that file in step 5), so it's fine to overwrite if it warns you.
The only remaining step is to transfer your plugins. You can do it via FTP, although it's probably faster to add them directly through the Wordpress admin via "add plugin" and search + install.
Oh yeah, now go to permalink settings and click "default", update, then choose whatever you want-- you need to refresh permalinks to.
That's foolproof... but you have to be somewhat familiar/confident using PHP myadmin. Although I've founds some widgets do not transfer via this method, so you may have to drag and drop some widgets again (appearance -> widgets) after the transfer.
For clarification on step 1 and step 3, see the diagrams here: http://webdesignerwall.com/tutorials/exporting-and-importing-wordpress ... but the rest of that WDW tutorial is guaranteed to give you problems at somepoint.

As mentioned in the comments, you will need to browse to the Settings->General page and update your site URL and wordpress URL.
If you can't get to the Settings page because you get redirected to your local site (this has happened to me before), you may have to edit the values in mysql directly, which isn't too bad, really.
The settings are located in the wp_options table under the option_name "siteurl" and "home". If you need more help with that, post a comment.

You may need to refresh your permalinks: see step 5 below. Official documentation on this subject may clear some things up as well.
Steps to move a local WordPress install to a live site
This is my method, and it has worked every time. Assume local WP install is at http://localhost/wordpress/ with WP database named wordpress and live WP install is at http://livesite.com/ with WP database named livesite:
Create a backup of local WP database -
navigate to http://localhost/phpmyadmin
select database wordpress from side menu
click EXPORT
check the box for Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT statement
click GO - it should download a file called wordpress.sql
Download a database for the live site -
sign in + navigate to http://localhost/wordpress/wp-admin/options-general.php
enter the live site values for WordPress Address (URL) and Site Address (URL)
click SAVE CHANGES - this will break your local WP installation: that's why we made the backup
repeat step 1 [Create a backup of local WP database] - include all substeps
rename this newly downloaded file from wordpress.sql to livesite.sql
Prepare WP files for live site
upload WP file structure to http://livesite.com/
edit /wp-config.php to have live database name, username and password
Import live WP database - if you haven't created the livesite database yet, do so now
navigate to http://livesite.com/phpmyadmin or equivalent
select database livesite from side menu
click IMPORT
choose local file livesite.sql from step 2
click GO - it should successfully import the livesite database
Refresh live site permalinks - your permalinks are set correctly but not updated to reflect the new domain, so get WP to update them
navigate to http://livesite/wp-admin/options-permalink.php
click SAVE CHANGES
it should alert permalink structure updated. If not make a frivolous change to get it to do so, e.g. change permalink structure and then revert
Revert local installation - this can really be done at any point after step 2.
Follow step 4 from http://localhost/phpmyadmin using the backup created in step 1. This is the only way to fix the local install because we changed the domain in step 2 and we can't even get back to the settings page.
NOTES
using WP 3.3.1
using phpMyAdmin 3.4.8

The reason behind this, After you move wordpress site from local server to live you not changed the site url and home address.So, when ever you try to open your site in real server it will redirect back to your local server.You need to open PhpMyAdmin Tool in Cpanel or FTP and select your database then open wp_options table.
In wp_options table change the value of site url and home.
Now your problem will solved.

Related

Issue accessing local hosted Wordpress site (redirects+other nonsense)

I have ran into quite the issue.
I have been developing a website hosted locally with MAMP. I always used localhost:90/wordpress/ to access the website and it was worked up till today. A few hours ago, I began the process of moving the website from local server to an actual domain. Unfortunately, I wasn't checking URLs and ended up changing some information and working on localhost myPHPadmin panel as opposed to the domain myPHPadmin panel. Long story short, I changed so much before I realized my mistake, then proceed to change even more, and now I am lost and don't know what to do. At this point, I am just trying to get access to my local hosted website so I can start over again.
The issue:
Everytime I goto localhost:90/wordpress, Chrome redirects me to localhost/wordpress and my website doesn't show, it says that the website can't be shown.
I have tried going into my local hosted myPHPadmin panel and changing siteurl and home to both say localhost, but no luck. Interestingly, when I change both to wordpress, it shows an unformatted version of my homepage (Kinda like just straight HTML), with limited images, however if I click any links then it brings me to wordpress/about and it doesn't exist. If I change it to just localhost:90, it shows my unformatted wordpress Page not found page. Can't access wp-admin with any of them.
I have tried using a replace tool recommended in another thread, but searching for localhost and replacing with localhost:90 yielded no results for me. I have also double checked the .htaccess folder and it is correct. I have cleared cookies/cache and still nothing. I am desperate.
Any help is much appreciated.
I am not sure what the issue is here so I am going to shoot in the dark here and hopefully one of these methods will get you out of your predicament. Since you say that you have reverted all the changes you made and still your website is inaccessible, even wp-admin.
You can try doing the following:
Change the siteurl and homeurl links in your PHPmyadmin to localhost:90/wordpress or whatever it was before when your site was running and functional.
In your Wordpress root folder, there is a file called wp-config.php. Open that file and find:
* #package WordPress
*/
Add after:
define('WP_HOME','localhost:90/wordpress');
define('WP_SITEURL','localhost:90/wordpress');
You will replace all localhost:90/wordpress if need be by which I have written in my codes to what the link was before; when the site was functional.
Check the file thoroughly and through Find/Replace function of your favourite text editor for no duplicate entries.
Now try accessing wp-admin. If you still cannot access your wp-admin, take a backup of your current wp-admin folder.
From a fresh Wordpress of the same version as yours, copy the wp-admin folder and replace it with your current wp-admin folder. Now try to access wp-admin again.
If you are able to access it and login, refresh your Permalinks. See if your site is accessbile again after doing these steps.
Update:
Since none of those steps worked for you, try doing the following:
Delete all the Wordpress core files from your localhost:90/wordpress EXCEPT wp-config.php and your wp-content folder.
Now from a fresh Wordpress folder, copy the files and folders EXCEPT wp-config.php file and wp-content folder. Paste them in your localhost:90/wordpress folder.
Try accessing your website now.
Update 2:
Try uploading your Wordpress to your online server and change the values of siteurl and homeurl in your wp-config.php file. We defined the localhost addresses in the file, now you will update those with your domain details.
Take a fresh backup of your database from your localhost and import it into a new database in your online server. Update the homeurl and siteurl in your newly imported database.
Update your wp-config.php with the new database name and username and password of the account you have given all privilages to access the database.
Try accessing wp-admin now.
If successful, update your Permalinks and then try accessing your website.
This will tell us if your localhost is faulty.

Change database server is WordPress

I have to update (move) actual database (exported as .sql from phpMyAdmin) to new one (already imported, same as old database). Problem is that, when I update file wp-config.php to new database (I just updated dbname, user, password and server), then it show up installation. When I set it back to old databse, it works OK. So, there is something that I need to update in DB? It seems like there would by any option about installation? Not sure, because new databse is well-filled.
So there is this neat tool I like to use when migrating the entire installation that I've developed locally.
Search Replace DB
Say you've developed everything locally, and even put the content in. Naturally WordPress will populate database with local links - something like
http://localhost/wp-content/uploads....
But when you move this to a new WordPress installation (clean), you cannot just import the exported .sql database, because it contains the old links with your localhost in it.
So that's why you first copy your old installation to the new server, then import the database, and then create a folder called sr where you put in the aforementioned script.
Now it's important not to open the newly copied WordPress installation once you've imported the database, because you'll get mixed links, and it could get messed up here.
Instead go to the /sr folder on your live site
http://www.yoursite.com/sr
And you'll see a search and replace screen.
There, just change
localhost -> www.yoursite.com
or whatever the equivalent to your localhost might be, in my case it's usually IP address of the test server I am developing.
Your database details like name, username and password should be pulled from the wp-config.php file.
Then just click dry run. This will show you all the replaced links in the database. Then you can inspect to ensure that you've correctly replaced the links - you only need to change the 'base' of the link. The path to uploads folder, for instance, should remain the same (remember, you've copied the entire wp-content folder to your live server).
If you think it's ok, do a live run, and let the script replace the links. After it's done delete it from the server - the entire /sr folder. Because if you leave it, someone could mess up your database.
After that, you can log in to your WordPress and all the content should be there exactly as you've left it on your localhost.
Hope this helps :)
You can use wp migrate db plugin to migrate you db for new server , after installation it require new server url and absolute path after that you and get original db to import .

WP migration, can't login to WP admin

I was in the middle of migrating a local WP site to a live server and came across a problem.
I edited my WP config file and uploaded it along with the rest of the WP files. I also uploaded the mysql database through phpMyAdmin.
Once i tried to test the site i got an error message "The page isn't redirecting properly". I then, mistakenly, logged in to the admin area and in the Settings > General tab I deleted the localhost part of the URL. Now I'm unable to log back in to the WP admin area.
EDIT
To clarify, my major problem is that i can no longer log in to the wp admin area because of something I've done. The steps i took to get to this point were:
Backed up WP using the BackUpWordpress plugin
Edited back up wp-config file with define('WP_HOME','http://example.com'); define('WP_SITEURL','http://example.com');
Created mySQL database through DreamHost
Changed database info in wp-config file
Uploaded wp files (not including mySQL backup) to my url using Filezilla
Imported mySQL database backup to DreamHost
I then checked the site from my browser, an error message said too many redirects occurred
From the wp admin area i went to Settings > General and deleted the localhost part of the url that was displayed.
I believe it's due to the previous step I'm now unable to access the wp admin area at all.
I need a way of getting back into the admin area
You can also edit those options within phpMyAdmin. Go to wp_options and locate siteurl and home. Make sure the URL matches your site URL.
You can also edit the site URL in your wp-config.php.
Add these lines somewhere above the /* That's all, stop editing! Happy blogging. */ line.
define('WP_HOME','http://my-site.com');
define('WP_SITEURL','http://my-site.com');
This should overwrite your database settings.
I believe the problem is that studiomed.co.uk is permanently redirected (301) to www.studiomed.co.uk and www.studiomed.co.uk is permanently redirected (301) to studiomed.co.uk
Login to your Dreamhost account go to Domains->Manage Domains and choose one of the three options there are in "Do you want the www in your URL?".
After that use an ftp program to download the .htaccess file that exists in your root installation of wordpress and open it with your favorite editor. Check if you have any kind of redirection in the .htaccess file.
Which version of WordPress do you use?
Can you list the plugins you are using?
Have you gone through the basic WordPress troubleshooting steps?
flush any caching plugins you might be running, as well as server
and/or browser caches.
deactivate all plugins to see if this resolves the problem. If this
works, re-activate the plugins one by one until you find the
problematic plugin(s). Sometimes, an apparently inactive plugin can
still cause problems.
If you can't get into your admin dashboard,
try resetting the plugins folder by FTP or PhpMyAdmin (read
http://codex.wordpress.org/FAQ_Troubleshooting#How_to_deactivate_all_plugins_when_not_able_to_access_the_administrative_menus.3F
if you need help).
switch to the Twenty Eleven theme (depends on your WordPress version) to rule out any theme-specific problems.
If you can't log in to change themes, you can remove the theme folders via FTP so the only one is twentyeleven. That will force your site to use it.
manual upgrade. When all else fails, download a fresh copy of the latest.zip file to your computer, and use that to copy up. You may need to delete the wp-admin and wp-includes folders on your server. Read the Manual Update directions first: http://codex.wordpress.org/Updating_WordPress#Manual_Update
check the Master List to see if you're experiencing a known issue
Login to your wordpress dashboard (wp-admin) and go to Settings->Permalinks, select Default and save changes.
Update all urls(path) using this querys then check:--
Use this querys for change all urls(path) for db then check
UPDATE wp_options SET option_value = replace(option_value, 'http://live_ste_path.com', 'http://localhost/local_site_path') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, 'http://live_ste_path.com', 'http://localhost/local_site_path');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://live_ste_path.com','http://localhost/local_site_path')`
[WSOD RESOLVED]
Since I could not find any solution to my problem by googling around, a crucial tracking info I finally found in WP error logs. So I would recommend to inspect logs before spending to much time looking for a proper answer by google.
After migration from an old web host to a new one, in my multisite environment all sites were working. Also, I was able to administer all subsites - but one! Trying wp-admin login to that site led me to fatal white screen. Without any message or any indication about the reason. And the culprit was corrupted file /public_html/subsite-x/wp-admin/admin.php. I really could not understand how that happened, just might suppose it appeared somehow while transferring files (FTP) from old host to a new one.

Error when running WordPress on new server

I've just upload a WordPress project into a web server. Everything went fine with the exception of the User-Photo plugin. The problem I'm having is that its doesn't seems to find the basedir path. This is the error:
Upload error: Unable to place the user photo at: /var/www/clients/client2/web4/web/arsoblog/wp-content/uploads/userphoto/1.jpg
First of all, I don't know where this path is. Even on the local server, where the site is working good, is using the exact same path, which I can't find.
Maybe someone of you knows what could have changed from one server to the other. By the way, the blog is inside another site in the web server, which is developed using CakePHP.
EDIT --- I'm having the same problem with all the uploads!
The problem is in your upload directory. When we develop the WordPress site in localhost, the default upload directory will be point to your localhost only. When you move to online server, this directory path will not change.
To override this do the following steps:
Login to your cPanel/control Panel
Go to phpMyadmin
Select your database.
Go to wp_options table
On the second page (around 58th row) Edit 'upload_path'(For the first time this row may be blank).
Give your correct directory.Eg: /home/username/public_html/folder-name/wp-content/uploads
Change "username" and "folder-name". Username is usually the username you use to login to cPanel, or your domain’s control panel. Folder-name is used for the sites hosted in subfolders. If you hosted the site in root folder, remove it.
Here is a detailed tutorial How to move wordpress to a new server or host.
If you already used WordPress uploader in localhost, you need to do a search in wp_posts table and replace your localhost reference to your live site's reference. There are some plugin available to do these search and replace in database. Check this one
Hope this will solve your problem.
777 permissions are dangerous and not the correct fix for the issue. You will get hacked with 777 permissions. See Hardening WordPress « WordPress Codex
For solving this problem you have follow some step,
*Login to your cPanel/control Panel
*Go to phpMyadmin
*Select your database.
*Go to wp_options table
*On the second page (around 58th row) Edit 'upload_path'
*Give your correct directory.Eg: /home/username/public_html/folder-name/wp-content/uploads
then you shift your server See tutorial
for more
http://www.techyv.com/questions/error-when-running-wordpress-new-server

Dynamically-related files could not be resolved because of an internal server error - Dreamweaver CS5 Error

I am building a Wordpress website in Dreamweaver CS5 and am also using MAMP for my PHP/MySQL needs.
The problem is that when I create a new Wordpress site in Dreamweaver (I have an existing Wordpress template), and I open the index.php file, it asks me if I want to discover any other files that are dynamically related to the index.php file. I click "Discover", then I get this error: "Dynamically-related files could not be resolved because of an internal server error."
My MAMP document root is: /Users/Burton/Sites/
In the document root I have a sub-directory called Wordpress where all the Wordpress files (including my theme) are stored
In Dreamweaver I created a new site and here are the settings for it and the server:
Site Name: Test Site
Local Site Folder: /Users/Burton/Sites
Server Name: Local Testing
Connect Using: Local/Network
Server Folder: /Users/Burton/Sites
Web URL: http://localhost:8888/Wordpress
Server Model: PHP MySQL
Testing: On (Make it a test server)
Going to the site via a web browser is fine, I can see the template and everything. I can edit the site in Dreamweaver and see the changes made in the browser, but I want Dreamweaver to discover those other files so I can do Live View in Dreamweaver, but this error is preventing me from doing it.
I've looked at countless tutorials and visited many forums but no one has the answers...
Anybody out there have idea what is causing this?
Thanks!
This happens with DW and WordPress sites because WordPress doesn't use normal include calls but instead does this dynamically based on what the user is doing at the time. DW cannot handle that complexity in design view and chokes on it, displaying the message that you see.
I had this issue, for me it was a mixture of the mysql server address in wp-config.php pointing to localhost when infact the database was on a different domain, and wordpress thinking that it was deployed on the remote / live domain rather than locally.
Changing the database vars (they are at the top of the file, well commented) to point to the right database fixed it.
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'DATABASENAME');
/** MySQL database username */
define('DB_USER', 'DATABASEUSER');
/** MySQL database password */
define('DB_PASSWORD', 'DATABASEPASSWORD');
/** MySQL hostname */
define('DB_HOST', 'DATABASEADDRESS');
Also, make sure you have, locally, a complete copy of all files in the wordpress install. I installed mine on a remote server via a CGI script, if you do the same then make sure you copy the whole lot to your local site.
The last peice of the puzzle for me was changing the WordPress address (URL) and Site address (URL) inside wp-admin to point to my local copy, relative to Dreamweaver - i.e 192,168.x.xxx/wordpressinstall
(I had to log in on my domain (www.wordpresstest.something) to access the admin tool to do this, then it redirects back to the new address when you save - so make sure you have it correct or it's hard to fix).
Hope this helps anyone else with the same problem.
I found this on this thread
I have come across the same issue and found this thread. The post that explains a bit what we want to hear is post #6 by David_Powers on 01-May-2010 at 05:31.
So to make the problem go away you can go to 'Edit -> Preferences' and disable 'Discover Dynamically-Related Files' while leaving 'Enable Related Files' activated.
Although this fixes the error display I don't quite understand what David_Powers says this function will do and if I actually want it turned on. If someone could help me realize what this option does I would appreciate it.
I found the solution from this link
And verified solution is as follow:
Open your site in Dreamweaver and wait for the message at the top, telling you that there are related files to be discovered. Hit “Discover” and get the error message.
Next login to your local WordPress site via a browser and remember what the current Permalinks are set to (under Settings – Permalinks).
Choose the Default (first option) and hit save.
Go back to Dreamweaver and try the discovery option again. All related files are discovered – hurray!
Head back over to your WordPress site and change the Permalinks back to what they were, then hit save.
I know this is a bit hacky, but until Adobe can figure out a working solution this is as good as it gets, and not really that cumbersome.
It's all about "Permalinks". The problem is the web URL address that you have entered in the test server setup has not the same structure, which WordPress uses.
Open your WordPress Dashboard, under Settings choose Permalinks ( Settings > Permalinks ). You'll see what structure is defined in Wordpress and, maybe, this is a different one, which you have introduced into DW: http://localhost:8888/Wordpress. And your permalinks structure in the WordPress is like http://localhost/yoursite/?p=123.
Check custom structure radio button - http://localhost/sitename and click Save.
Go back to DW site > Manage sites > Edit {your-site}, in the Server tab choose your server, hit the Edit button and put the same structure in the web URL box: http://localhost/sitename.
Local site folder and server folder should be like C:\wamp64\www\sitename\.
I use WAMP and DW on Windows, so do the math yourself.

Categories