不小心改了WordPress 地址(URL)的看过来-WordPress 新手指南论坛-WordPress-光子社区 | 技术交流与生活分享的理想平台
4
share (joys, benefits, privileges etc) with others

If you accidentally changed your WordPress address (URL), look over here!

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".

d2b5ca33bd20240816155331

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.

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

  1. Database management tools for accessing the website::

    • Access phpMyAdmin through your hosting control panel (e.g. cPanel).
  2. Select WordPress Database::

    • On the left hand side, select your website database, which usually starts with a wp_ The name at the beginning.
  3. compiler wp_options a meter (measuring sth)::

    • locate wp_options table and click "Browse".
    • In the table's option_name column, find the siteurl respond in singing home Options.
  4. modifications siteurl respond in singing home value of::

    • strike (on the keyboard) siteurl respond in singing home to change their values to the correct URL of your website (e.g. http://yourdomain.com).

d2b5ca33bd20240816155542

    • Click "Execute" to save the changes.
  1.  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

  1. Access to the site's subject directory::

    • Through an FTP client or file manager, go to the wp-content/themes/your-theme-name/ Catalog.
  2. compiler functions.php file::

    • locate functions.php file and select Edit.
  3. 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.
  4. 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:

  1. Access to the web site root directory::

    • Access the root directory of the site via FTP or file manager.
  2. Find the .htaccess file::

    • Make sure the file is visible and select Edit.
  3. 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.
Please log in to post a comment

    No reply content