Configuring and Accessing the Hosts File Shows With an ip Address

Asked 2 months ago, Updated 2 months ago, 2 views

Multiple site development environment directories are built in CentOS within VirtualBox.
I want to set the path in the directory to be the same as in the production environment.
Virtual host configuration for Apache was successful.


Local Machine (PC with VirtualBox on Windows 10) I set the following settings in the hosts file:

192.0.2.10 example.com


Accessed from a browser on example.com The contents are displayed, but the url part is 192.0.2.10.

To have example.com display this as it is What should I do?

By the way, this is the WordPress site.
If this is a duplicate question, I am sorry to trouble you, but I appreciate your cooperation.

windows apache wordpress

2022-09-30 11:10

2 Answers

If you have configured hosts, you should see the domain name that you configured.
...but isn't the URL of the site set to wordpress IP?
As soon as you visit the site you set up in wordpress,
You may have been redirected to the configured site URL.
(Other suspected redirect, such as being redirected in Apache configuration)I see)

add
I don't know the cause, but if the URL you set makes it inaccessible,
Edit the database directly to correct the URL or
I think you should include the option to ignore the database.

Speaking in the database
I think there are two types of siteurl and home in the wp_options table.
I think you can correct it by correcting these two types of values.

siteurl is the URL with the admin screen.
You must not end this URL with a "/".

This is the URL that home publishes.
End this URL with a "/"


2022-09-30 11:10

There seems to be a tool like the one below that can convert the URL in bulk, so just for your information.
Database Search and Replace Script in PHP

The following article may be easy to understand in Japanese.
Do not replace URLs directly with SQL during WordPress migration!Use Search and Replace for WordPress Databases Script | infoScoop Developer Blog


2022-09-30 11:10

If you have any answers or tips


© 2022 OneMinuteCode. All rights reserved.