If you've accidentally changed your address, look over here.
In WordPress The site's settings were accidentally changed in the WordPress address (URL) or site address (URL), which may result in the website not being accessed properly. If you encounter this situation, do not worry, the following will detail several common solutions to help you quickly restore the normal operation of the site.
Method 1: Fixed by wp-config.php file
1. Access to the website's file manager::
-
- Access the site's root directory through an FTP client (such as FileZilla) or the host's control panel (such as cPanel).
2. Find and edit wp-config.php
file::
-
- In the root directory, find the
wp-config.php
file, right click and select "Edit" or "View/Edit".
- In the root directory, find the
3. Add the following code::
-
- exist
wp-config.php
file in the appropriate place (usually in the/* That's all, stop editing! Happy blogging. */
before), add the following code:define('WP_HOME','http://yourdomain.com');
define('WP_SITEURL','http://yourdomain.com');
- commander-in-chief (military)
http://yourdomain.com
Replace it with your actual website URL.
- exist
4. Save the file::
-
- After saving and closing the file, try revisiting your site and the problem should be resolved.
Method 2: Repair through database
-
Database management tools for accessing the website::
- Access phpMyAdmin through your hosting control panel (e.g. cPanel).
-
Select WordPress Database::
- On the left hand side, select your website database, which usually starts with a
wp_
The name at the beginning.
- On the left hand side, select your website database, which usually starts with a
-
compiler
wp_options
a meter (measuring sth)::- locate
wp_options
table and click "Browse". - In the table's
option_name
column, find thesiteurl
respond in singinghome
Options.
- locate
-
modifications
siteurl
respond in singinghome
value of::- strike (on the keyboard)
siteurl
respond in singinghome
to change their values to the correct URL of your website (e.g.http://yourdomain.com
).
- strike (on the keyboard)
-
- Click "Execute" to save the changes.
- 5. Verify that the site is back up::
- After saving the changes, try to revisit your site and it should work.
Method 3: Fixed by functions.php file
-
Access to the site's subject directory::
- Through an FTP client or file manager, go to the
wp-content/themes/your-theme-name/
Catalog.
- Through an FTP client or file manager, go to the
-
compiler
functions.php
file::- locate
functions.php
file and select Edit.
- locate
-
Add the following code::
- Add the following code to the file:
update_option('siteurl','http://yourdomain.com');
update_option('home','http://yourdomain.com');
- commander-in-chief (military)
http://yourdomain.com
Replace it with your website URL.
- Add the following code to the file:
-
Save and visit the site::
- Save the file and refresh your website homepage. If the problem is resolved, remember to go back and delete the code you just added.
Method 4: Modify the .htaccess file (only in special cases)
If your site uses .htaccess files for URL redirection or other configurations and changing the address does not solve the problem, try the following:
-
Access to the web site root directory::
- Access the root directory of the site via FTP or file manager.
-
Find the .htaccess file::
- Make sure the file is visible and select Edit.
-
Checking or resetting .htaccess file contents::
- Check the contents of the file for errors or replace the existing contents with the following default code:
plaintext
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} ! -f
RewriteCond %{REQUEST_FILENAME} ! -d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
- Save the file and try to visit your site again.
- Check the contents of the file for errors or replace the existing contents with the following default code:
No reply content