Migrating Wordpress to a site with a subdirectory - php

I've migrated many Wordpress sites before, but now I'm having an issue I just can't seem to solve. Some, but not all of the links are not loading properly.
I'm migrating from local.dev to example.com/test.
In my database options, I have both options set to example.com/test.
I doubled checked the options in the WP backend, and they're example.com/test.
I've updated my permalinks.
All of the pages work, all of the links work, but a few references to images, etc do not - they're loading example.com/ instead of example.com/test.
I think it might have to do with the .htaccess file, because I can't update it from the FTP side. If I delete it and update permalinks, no .htaccess file is created. I don't have access to any server side overrides, only the files.
In my MAMP vhosts, I have SymLinks Override set to All, but I can't edit anything like that on the live host.
The links that aren't working are along the lines of $image = get_post_meta(37 ,'_my_meta',TRUE)['img']; which should return
http://www.example.com/test/wp-content/uploads/image.jpg
but instead returns
http://www.example.com/wp-content/uploads/image.jpg.
Using bloginfo('wpurl'); returns http://www.example.com/test, and all similar ones return properly (site_url();, 'template_directory', etc.
In the end, the site is going to go on http://www.example.com without the subdirectory anyway, but I'm sure I have to get it to work properly to prevent future errors.
I also updated to the newest version of Wordpress at some point, not sure if that could cause any issues.

I believe the issue deals with media and links placed in content items.
I use to do some manual SQL queries to fix this but now I run this plug-in https://wordpress.org/plugins/automatic-domain-changer/
The plug-in will go through all the content and make the needed changes.

The links that aren't working are along the lines of $image => get_post_meta(37 ,'_my_meta',TRUE)['img']; which should return
http://www.example.com/test/wp-content/uploads/image.jpg
this meta information is stored in the DB. then to make the migration you have to change all the old URL in the DB before to import it in the new place

Related

Wordpress site failes to load js and css

I have this weird problem with my Wordpress Website. I worked on localhost and afterwards I tied to get my site online but i modified some configuration files and i don't know witch one is the fault. I am using XAMPP. The website right now is seems to not load js and css. Also on console log it gives 404 error for not fiinding the files it needs.
Landing page:enter image description here
Another Page:enter image description here
do you use gzip compression or such as it? if yes try to disable it, and make sure you have the right path
First, check that the file permissions are correct.
Also, if you have changed anything on your .htaccess files, overwrite them with the default ones: https://github.com/WordPress/WordPress
Also it's always a good idea to go to the permalinks page (/wp-admin/options-permalink.php) to update the links of all dependencies to the new URL.

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.

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.

How to Transfer Wordpress Website?

i want to transfer wordpress website from one hosting provider to another. i try also transfer but after transfer i can not change the Permalink.i change the Permalink from default to Post name. but err shown ...
"404 Not Found"
set old-domain to new-domain in guid column in the wp-post table in WordPress database
And also change the siteurl and home in wp-option table.
check below link
https://wordpress.org/support/topic/updating-links-in-old-posts-when-things-change
There are a number of things that could be wrong. Usually this error occurs when there is no .htaccess file present, or it's not configured correctly. (Keep in mind: if you new host is not running Apache, then you're not dealing with .htaccess altogether) It might also be that mod_rewrite is not set.
First thing to try though: set your permalinks back to default, or date and save it. Then set it back to pretty permalinks with %postname% and save it. Quite often this actually solves your issue in case the correct accessfile is actually present. :')
It also depends on whether you have changed the domain?
Look at this: https://codex.wordpress.org/Moving_WordPress
i think problem is in your database replacement.
please try this link Click here to download file and relapse your database.
before run this file make backup your database.
following this step.
i)uplode download file in your folder(root folder eg.wp-config.php location).
ii)run this folder.
iii)first run as dry run.if any change is found than run as live.
For me, only way you should ever do it if you at least don't have solid server-side knowledge is using All-in-one WP Migration plugin.
https://wordpress.org/plugins/all-in-one-wp-migration/
It allows you to export your database, media files, plugins, and themes. You can apply unlimited find/replace operations on your database and the plugin will also fix any serialization problems that occur during find/replace operations.
There is a WordPress plugin called duplicator. Using this plugin we can transfer WordPress website from one host to another. I think this is the simple and easy way to transfer WordPress sit. Here is the link.

Homepage not loading, all other pages loading in WordPress migration

Nobody has had this problem yet it seems.
I just migrated a small WordPress website from my test server-space on iPage over to a client's server on HostGator and while I am logged into WordPress on the new server - the website shows up fine, but if I clear my cache and come on as a new user (as my boss did) they find the silly 2014 theme with no content. But if they go to a specific link it loads fine and then so does the homepage.
I have searched this topic extensively but found nothing. I have tried other migration problems' fixes such as:
adding a new php.ini
uploading new indexes to the root dir and theme dir
saving permalink settings again, and then changing and saving again
updating WP version
deactivating plug-ins
changing .htaccess lines
Why was it working perfectly on the old server location but not the new?
Y'all are my last resort. Is there some sort of cache error (or normal activity that needs overriding) going on? .htaccess? index.php? Is it HostGator's servers maybe?
Please help!
UPDATE: A combination of changing the site/home url in WP_Options and re-saving the permalinks fixed this issue for me.
One of the reasons why wordpress urls contained in the BD pointing to the url old, running this script in phpmyadmin can solve:
UPDATE wp_options SET option_value = REPLACE(option_value,'old_site','new_site');
UPDATE wp_posts SET post_content = REPLACE(post_content,'old_site','new_site');
UPDATE wp_posts SET guid = REPLACE(guid,'old_site','new_site');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value,'old_site','new_site');
Also exist the possibility that your hosting account contains a folder with your username, in the wp_options table may be included, for example upload_path: /home/[folder_old_id]/public_html/wp-content/uploads
UPDATE wp_options SET option_value = REPLACE(option_value,'folder_old_id','folder_new_id');
The behaviour you describe is not what I am seeing "But if they go to a specific link it loads fine and then so does the homepage.":
I get the same result following a home link as typing the URL so this is simply a configuration issue
Try this:
rename any .htaccess files .htaccess.temp
look directly in the wp_options table in the database to make sure all entries are correct
review the $site_url in php.ini
taking your test environment offline
This will eliminate most (all?) of the possible reasons your site is not behaving.
Good luck!
Hey I faced the same issue.
If you have just copied the Wordpress files for the mogration, check if you have copied the index.html file from your local site to your production site and delete it. This should fix the issue.
I actually ran into the same/ a similar problem. Homepage didn't work but subpages did. I solved it by looking through my files on the server (FTP) and renaming a mysterious "index.htm" to "index.htm.temp". Turns out wp took this index.htm as the default file for my landing page. Renaming and later deleting it solved the issue.
My website was migrated using the WP Duplicator PlugIn.
Well, if you consider your problem something someone "wants" to do, then you'll find a lot of resources... for example:
https://wordpress.org/support/topic/using-a-different-wordpress-theme-for-a-single-page
Apparently you can create a page template and have the template load a different theme then all the other pages on the site. You can theoretically have every page on your WordPress install run a different theme.
Check things like home.php, front-page.php and what not to see if the homepage is running a template.

Categories