Wordpress home address in magento is giving 404 error - wordpress

I have integrated WordPress into my Magento 2 application using Fishpig. I have changed WordPress home address as sitename/m4blog.
In my local http:localhost/sitename/m4blog is working fine. But when I deployed same thing to server, then getting 404 error. In server the url is https://sitename/m4blog. I have checked the perma links settings. Beow Permalinks settings it is like this
If your .htaccess file was writable, we could do this
automatically, but it isn’t so these are the mod_rewrite rules you
should have in your .htaccess file. Click in the field and press
CTRL + a to select all.
After this there is code for .htaccess. So I replaced my .htaccess in server with this code . But no use. Could anybody help me out to resolve the issue?

First way
Set your WordPress setup folder name "wp".
M2 Admin Menu > WordPress > Path = wp
Database: magento2_wp > Table: wp_options
option_id = 1
option_name = siteurl
option_value = http://www.example.com/wp //Folder name of your WordPress installation.
autoupload = yes
option_id = 2
option_name = home
option_value = http://www.example.com/blog //Frontend URL
autoupload = yes
Second Way
Go to wordpress folder most probably inside root.
edit .htaccess and paste a code you display on admin
Save it.

Related

WordPress image URLs have a blank space before /wp-content

I have run into a WP site which is not loading almost all images. The developer tools console shows 100s of these errors.
Failed parsing 'srcset' attribute value since it has an unknown descriptor.
Dropped srcset candidate "https://domain.tld"
After looking at the source code of the page, I found that the image URLs have a space before /wp-content/
This is happening for all src and srcset URLs.
I have tried troubleshooting by deactivating all plugins, but it did not fix the problem.
How do I go about fixing this issue?
The issue is that siteurl and home setting have a space at the end. The setting can either be found in wp-config.php file or in the database. I had to run the following command to fix it (replace https://example.com with the name your domain)
UPDATE `wp_options` SET `option_value` = 'http://example.com' WHERE `wp_options`.`option_name` = 'siteurl';
UPDATE `wp_options` SET `option_value` = 'http://example.com' WHERE `wp_options`.`option_name` = 'home';
You might find the following lines in wp-config.php:
define('WP_HOME','https://example.com');
define('WP_SITEURL','https://example.com');
Make sure they don't have a space at the end

When i installing my wordpress website in my local server it redirecting the live url when i am loading the url of localhost .

Sometime it redirecting to live or it showing not found page
NOTE : I changed all the live url to localhost in the database and set up in the way it should be done.
i cant determine the problem
you can try below solutions
1) Delete .htaccess file from your project root folder in localhost and generate again using permalink from wp-admin -> Settings-> Permalink just click save button and it will generate automatically to root folder of the project.
2) Go to wp-admin -> Settings -> Genral Settings change
WordPress Address (URL) -> to http://localhost/your project name
Site Address (URL) -> to http://localhost/your project name
3) Make sure that in Wamp or Xamp server the Apache Modules rewrite_module is on
Change and Update WordPress URLS in Database When Site is Moved to new Host and check htacess file
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');

Wordpress Multisite SubSites: 302 Moved Temporarily

I've recently changed the domain for Multisite website, I followed the instructions from here https://wpengine.com/support/how-to-change-a-multi-site-primary-domain/
Now, only main site(http://domain.com/) works but the other sites (e.g: http://domain.com/es/) are giving error "302 Moved Temporarily" and redirected to itself (http://domain.com/es/).
Under Network Admin > Sites > Edit(for sub site i.e: http://domain.com/es/) > Settings, Siteurl and Home is also same as the main URL rather than http://domain.com/es/. I tried to change it to http://domain.com/es/ but, opening the http://domain.com/es/ URL updates it back to http://domain.com/
in my wp-config.php file these lines are commented out
//define('WP_HOME','http://fruitionpartners.eu');
//define('WP_SITEURL','http://fruitionpartners.eu');
Is there something I am missing? Please help.

Migrating to local server

I have my wordpress site on my local server at the following path :
wordpress-4.2.3\wordpress\wp-content\themes\mytheme
and the url to access my local site is:
http://localhost/wordpress-4.2.3/wordpress/
Now I need to migrate it to another local server, for this I have imported database successfully and copied wordpress folder and placed it in my project's folder as below:
my-project-name\wp-content\themes\mytheme
and also changed WordPress Address (URL) and Site Address (URL) which is initially http://localhost/wordpress-4.2.3/wordpress/ to http://local-server-ip/my-project-name/ but it is not working. Any suggestions?
You need to replace all URLs in the database, it is not sufficient to change the values only in the options table (otherwise links and images are corrupted).
Manual Migration:
Export your database (e.g. through phpMyAdmin) and do a search&replace with the old and new url
Update your wp-config.php (database name, login and passwort)
Update your .htaccess file (check the RewriteBase and Rewrite Rule)
Migration with Plugin:
Download a migration plugin, such as "Wordpress Duplicator"
Copy all data to folder "my-project-name"
Open your database > click on SQL tab > Run these commands manually
---------------------------------------------------------------------------
WP Update Query in database
---------------------------------------------------------------------------
UPDATE wp_options SET option_value = replace(option_value, 'http://localhost/wordpress-4.2.3/wordpress', 'http://local-server-ip/my-project-name') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = REPLACE (guid, 'http://localhost/wordpress-4.2.3/wordpress', 'http://local-server-ip/my-project-name');
UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://localhost/wordpress-4.2.3/wordpress', 'http://local-server-ip/my-project-name');
UPDATE wp_posts SET post_content = REPLACE (post_content, 'src="http://localhost/wordpress-4.2.3/wordpress','src="http://local-server-ip/my-project-name');
then login to your wordpress admin panel go to Setting > Permalinks > click on Save Changes button.
Note: if you have changed your database don't forget to change credintials in wp-config.php

WP from remote to local

I really hope you can help me!
I need to make some changes on a WP website from Xampp on my mac.
I did the backup of the DB and via FTP I copied all the files in XAMPP/htdocs/b
I modified the wp-config.php as follow:
define('DB_NAME', 'db:name');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
after importing the DB I also changed the siteurl under wp_options.
Now my problem is this... wen I open the website no pictures loads and any link goes to /xampp/ folder
I tried so many things but nothing seams to work. I cannot even access the wp-login.php due to user and psw wrong.
please please help!
* I realise that img url is: img src="/wp-content/themes/nm/images/common/impcontent/mapfiller.jpg" so it looks for the imgs into the localhost/wp-content/... insted of localhost/b/wp-content/... how do I change that???
In wp-config.php set the following values to your proper values:
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
Once this is working, install and run https://wordpress.org/plugins/velvet-blues-update-urls/ to fix the path issues.
Execute the following query in phpmyadmin, note: wp_ is prefix of table. If you have changed the prefix of the table at the time of installation then use that prefix with wp_ in the below query
UPDATE wp_options SET option_value = replace(option_value, 'old_domain_url_here', 'new_domain_url_here') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'old_domain_url_here', 'new_domain_url_here');
UPDATE wp_posts SET post_content = replace(post_content, 'old_domain_url_here', 'new_domain_url_here');
Try using https://github.com/wp-sync-db/wp-sync-db
Install it both on localhost and on remote. Follow the instructions, set correct domains and push from local to remote. It should work nice :)

Resources