wp-admin can't access after moving - php

I need mention that I had google search the solution before post at here.
I move my wordpress site to another domain and different server.
wp_config.php edited; database, database username, passwword, and host all changed. table_prefix remain the same because i use the same one.
wp_posts and wp_option i had changed too.
I still got this error message anyway.
You do not have sufficient permissions to access this page
Anyone know what happen and how to fix this ?
wp-admin can't access after moving

If you are moving your domain without changing the Home and Site URLs of your WordPress site you can follow the below guidelines as prescribed by the wordpress codex.
If database and URL remain the same, you can move by just copying your files and database.
If database name or user changes, edit wp-config.php to have the correct values.
If you want to test before you switch, you must temporarily change "siteurl" and "home" in the database table "wp_options" (through phpMyAdmin or similar).
If you had any kind of rewrites (permalinks) setup you must disable .htaccess and reconfigure permalinks when it goes live.
EDIT (if your site url has also changed, well i am only phrasing from the codex site)
Moving a website and changing your domain name or URLs (i.e. from http://example.com/site to http://example.com, or http://example.com to http://example.net) requires the following steps - in sequence.
Download your existing site files.
Export your database - go in to mySQL and export the database.
Move the backed up files and database into a new folder - somewhere safe - this is your site backup.
Log in to the site you want to move and go to Settings > General, then change the URLs. (ie from http://example.com/ to http://example.net ) - save the settings and expect to see a 404 page.
Download your site files again.
Export the database again.
Edit wp-config.php with the new server's mySQL database name, user and password.
Upload the files.
Import the database on the new server.
When your domain name or URLs change there are additional concerns. The files and database can be moved, however references to the old domain name or location will remain in the database, and that can cause issues with links or theme display.
If you do a search and replace on your entire database to change the URLs, you can cause issues with data serialization, due to the fact that some themes and widgets store values with the length of your URL marked. When this changes, things break. To avoid that serialization issue, you have two options:
Only perform a search and replace on the wp_posts table.
Use the Search and Replace for WordPress Databases Script to safely change all instances.

Make sure that the web server is allowing you to view the page itself, and look in the httpd.conf or .htaccess file for the directory that the main Wordpress script lives in.
Make sure that the Wordpress files have the correct permissions. If you just copied them over, then the user that needs to accesses them (apache on many typical LAMP installs, but yours may be different) is able to.

If you have already copied all your files and moved all of it to the new directory, then all you need to do is set your site url, home url.
So for example, if you are working on wordpress locally, you might have had your original URL to something like this:
http://localhost/wordpress
and your new URL might be something like this:
http://wordpress.local
In the case above, you would need to modify your settings in the database.
Database settings:
Go to the wp_options table, and look for the column named option_name, look at the field that says siteurl and home. You will notice that next to them in the option_value field you had your old URL. Change this to your new URL, and you should be good to go.
Hope this helps.

Related

WP-Admin redirects to old URL (after editing config.php)

I am trying to get a client's WordPress site copied over to my company's server to use as a development site. I've ran into an issue when trying to log into the site's administrator panel; it redirects us to the existing site's URL instead (ending up as [OLD SITE]/[NEW URL]/wp-admin). Additionally, trying to go to any page other than the homepage gets a 404.
I've tried editing the wp-config and defining the WP_HOME and WP_SITEURL there, with no success. In a previous attempt we used a backup tool that was meant to replace references to the old URL with the new URL, and on another we ran queries and checked through wp-options in the database to be sure that we caught all of the old references. Still redirects to the old site.
We've tried restoring from two backups, Akeeba and BackUpWordPress. Our current attempt is a copy we've downloaded directly and then uploaded (with an imported SQL backup).
Another odd thing I've noted is that changing one of the URLs in the database causes more issues. Mainly, if I update the URL of 'wordpress-https_ssl_host' in the wp-options table, the theme breaks. Not sure where to go with this from here.
I'm always succesfully using the following script : search & replace:
https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
in order to update a wordpress site url.
Just copy the provided code in a directory under your site, then launch the provided index.php in a browser: the database infos should be automatically determined. Then specify the old and new urls and click on "Run" !
Don't forget to remove the created directory afterwards.
For solving this issue you have to change siteurl in database wp_options table
option_name = siteurl where
option_value = YOUR OLD SITE URL
change your old site url and update it with your local developement site URL
Hope this will help you..
We found the problem; as it turns out it was nothing to do with anything from the default WordPress files. The client was using an extension called WordPress HTTPS, and apparently that was causing a conflict somewhere. We renamed the extension's folder to disable it and everything ran fine. I imagine it was overriding what we were setting in wp-config.

Change URL on Wordpress

I have been working on a WordPress site.
www.example.com and the main homepage of my site(index.html) says "We're under construction etc." and it's just an image.
For the development of the website, I have been using a different directory - www.example.com/dev and everything I have developed has been under /dev(/dev/index.php etc.)
The website is now ready and I need to point the finsihed website (www.example.com/dev) to the actual public site(which is now under www.example.com) that I have finished. How do I go about this?
use this code for changing you website url
SET #oldsite='http://www.example.com/dev';
SET #newsite='http://www.example.com';
UPDATE wp_options SET option_value = replace(option_value, #oldsite, #newsite) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, #oldsite, #newsite);
UPDATE wp_links SET link_url = replace(link_url, #oldsite, #newsite);
UPDATE wp_postmeta SET meta_value = replace(meta_value, #oldsite, #newsite);
This can be done 2 ways,
You can do this easily by changing site_url in options table. Once you transfer data and change the url your site should be running on the new url. If you have stored static urls in post or pages then, you have to change that as well.
Export sql file from phpmyadmin. Now find and replace all urls from old to new ones.
Note: Keep your current development site working as, sometimes it's possible that contact form 7 or any data gets missing. For example, Widgets get in inactive mode sometime.
Once your new website is confirmed then you can remove your old website.
step 1:
Just copy your all files and folder from www.example.com/dev to www.example.com
step 2:
open your database and in table wp_option
siteurl
http:// www.example.com/dev to www.example.com/
home
http:// www.example.com/dev to www.example.com/
Moving Directories On Your Existing Server
Wordpress has a wiki page that explained this for you:
Moving Wordpress
Here are the step-by-step instructions to move your WordPress site to a new location on the same server:
Create the new location using one of these two options:
If you will be moving your WordPress core files to a new directory,
create the new directory.
If you want to move WordPress to your root directory, make sure all
index.php, .htaccess, and other files that might be copied over are
backed up and/or moved, and that the root directory is ready for the
new WordPress files.
Log in to your site.
Go to the Administration > Settings > General panel.
In the box for WordPress Address (URL): change the address to the
new location of your main WordPress core files.
In the box for Site Address (URL): change the address to the new
location, which should match the WordPress (your public site)
address.
Click Save Changes.
(Do not try to open/view your site now!)
Move your WordPress core files to the new location. This includes
the files found within the original directory, such as
http://example.com/wordpress, and all the sub-directories, to the
new location.
Now, try to open your site by going to yourdomain.com/wp-admin.
Note, you may need to go to yourdomain.com/wp-login.php
If you are using Permalinks, go to the Administration > Settings > Permalinks
panel and update your Permalink structure to your
.htaccess file, which should be in the same directory as the main
index.php file.
Existing image/media links uploaded media will refer to the old
folder and must be updated with the new location. You can do this
with the Better Search Replace plugin, WP-CLI's search-replace if
your hosting provider (or you) have installed WP-CLI, manually in
your SQL database, or by using the 3rd party database updating tool
Search and Replace Databases Script * Note: this script is best used
by experienced developers.
In some cases your permissions may have changed, depending on your
ISP. Watch for any files with 0000 permissions and change them
back to 0644.
If your theme supports menus, links to your home page may still have
the old subdirectory embedded in them. Go to Appearance > Menus and
update them.
Sometimes you would need to restart your server,
otherwise your server may give out an error. (happens in MAMP
software (Mac)).
It is important that you set the URI locations BEFORE you move the
files.
If You Forget to Change the Locations
If you accidentally moved the files before you changed the URIs: you have two options.
Suppose the files were originally in /path/to/old/ and you moved them to /path/to/new before changing the URIs. The way to fix this would be to make /path/to/old/ a symlink (for Windows users, "symlink" is equivalent to "shortcut") to /path/to/new/, i.e.
ln -s /path/to/new /path/to/old
and then follow the steps above as normal. Afterwards, delete the symlink if you want.
If you forget to change the WordPress Address and Blog Address, you will be unable to change it using the wordpress interface. However, you can fix it if you have access to the database. Go to the database of your site and find the wp_options table. This table stores all the options that you can set in the interface. The WordPress Address and Blog Address are stored as siteurl and home (the option_name field). All you have to do is change the option_value field to the correct URL for the records with option_name=’siteurl‘ or option_name=’home‘.

Files uploaded one domain to another domain but menu not working

I have configured a site using WP on my Development Server and now I have moved it to another server with new URL. I have changed URL in database as well. But, my menus are pointing to the OLD URL and I am getting a 404 error.
How can I change them?
Try to use some wordpress plugins to migrate your website between servers.
Duplicator is one of them.
https://wordpress.org/plugins/duplicator/
You will have to do minimum effort if you use some tools.
Make SQL dump, overwrite old domain, load dump.
Also checks configuration files & themes.
You probably forget some links in your database. Check the following fields:
In wp_options, options with the following option_name:
siteurl, home
In wp_posts:
Check all the guid values.
You need also to check that your .htaccess is using the correct RewriteBase.
If your menus are built from a special theme feature (not the default WP menu functionality), you may have some encoded string in wp_options that reflect the menu settings. If so check on this procedure.

Wordpress issue - siteurl and home option is being changed every time I log into the admin

I hope you can help me.
For some unknown reason, every time I log into the admin and update the site, afterwards the "siteurl" and "home" paths are always changed to a previously used "testsubdomain". I already hired a developer who gave up telling me that he isn't a Wordpress specialist and can't see where the issue is.
What I have done until now, I just went into the phpmyadmin every time I noticed that it happened again, and changed the entries back to its correct path manually. This has become a real pain because every time this happens, the contact form entries aren't forwarded to the client either, and he is losing potential business.
Can anyone help and point me into a direction of how to fix this?
The site is http://www.chinatownband.com.
Thank you in advance!
Check to see if the URLs are hardcoded in either wp-config.php or the active theme functions.php file. Those are locations that read the URL settings for WordPress and can be used to fix or hardcode the URLs because they will override the URL settings in the database (see http://codex.wordpress.org/Changing_The_Site_URL ).
You're looking for
define('WP_HOME','http://testsubdomain.com');
define('WP_SITEURL','http://testsubdomain.com');
If you find those, delete them and then change to http://www.chinatownband.com in the database with phpmyadmin as you have been doing.
If those settings are not in wp-config.php or the active theme functions.php file, download the whole theme and use a text editor to search the folder for those define lines.
And look in the root web directory for any non-core WordPress files and folders and check them, too.
In the end, you may also need to use https://github.com/interconnectit/Search-Replace-DB to safely find/replace URLs in the database. The URLs you are changing are only the 2 settings URLs and don't retroactively change any URLs in page/post content that are links to media, other pages, etc.

moving a wordpress website to a different url

I have a wordpress website for a minecraft server, the server name changed, so the website domain changed. I tried moving the forums to the other url, by coping and pasting all the files but using the same exact database. However, as you use website, it links you back to the original website a lot. If is the problem that the main domain name is inside the mysql database? If i change all domains inside the database, will this fully move the website?
Thanks
In your wp-config.php file, enter the line define('RELOCATE',true);
Access your login page from http://yoursiteurl.com/wp-login.php, go to settings and change the site url.
Remove define('RELOCATE',true); from wp-config.php
Wordpress has a whole guide on moving wordpress sites: http://codex.wordpress.org/Moving_WordPress
but the basic step is as follows:
goto: Administration > Settings > General panel, and change the site URLs there to your new url. this should update all post links, etc. in the database.
move files to new host
move database to new host.
Moving a WordPress web site is quite well documented here:
http://codex.wordpress.org/Moving_WordPress
If not, it really is just as simple as copying all the files and the database. To avoid FTP transmission errors and such, I have had more luck with compressing all the files into a single .tar.gz file then FTP'ing that to my computer and to the new web site, where I expand it.
Personally, I use cPanel (the most popular web hosting customer account/web site management tool). Their Backup and Restore for the database. And their File Manager's Compress and Expand to work with the .tar.gz
Changing domain names significantly complicates matters. I use the Search and Replace plug-in to handle hard-coded URLs. Or manually find and replace the URL in the database script.
Run this SQL to change url's in db.
UPDATE wp_posts SET guid = REPLACE(guid, 'old-url.com', 'new-url.com');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'old-url.com', 'new-url.com');
UPDATE wp_options SET option_value = REPLACE(option_value, 'old-url.com', 'new-url.com');

Categories