Here you can find tips and tricks everyday.

Monday, October 16, 2017

How to Fix: WordPress Site not Working on Localhost After Port Change


How to Fix: WordPress Site not Working on Localhost After Port Change


On the off chance that you have introduced WordPress on localhost (case: utilizing XAMPP) and afterward later you have to change the Apache's HTTP port number, you will find that the current WordPress introduces will quit stacking. It will auto divert to the URL with the old port number and neglect to stack. Attempting to stack the WordPress introduce will bring about a 404 blunder.

In this instructional exercise I will demonstrate to you how you can undoubtedly redress this issue so you can utilize the current WordPress introduces after a port change (no compelling reason to introduce WordPress starting with no outside help).

Little Background
I have a few localhost WordPress installs that I used using Apache HTTP port #81. I needed to change the port #80 so I could create a new localhost WP Multi-siteinstall (multi-site installs only work on port 80). When I changed the Apache’s configuration to use port 80, all my existing WordPress sites stopped loading. this tutorial contains the steps I took to resolve the issue.

The Main Reason for the Existing WP Site to Not Load

The reason the site isn't stacking after the port change is a direct result of the site URL esteem (that contains the old port number) in the wp_options table. So we will refresh that incentive to the new port number.

Refresh the WP Database Table
Here is how you can fix it by updating the port number value in the database:
  • >> Access PHPMyAdmin tool. http://localhost:80/phpmyadmin and log in.
  • >> Click on the WordPress site’s database (the one that is not working).
  • >> Click on the “SQL” tab.
  • >> We are going to execute a DB query to search and replace the old port value.
  • >> Execute the following query:

    UPDATE `table_name` 
    SET `field_name` = replace(field_name, 'old_text', 'new_text')
    
    In my case, the exact query that I executed is the following (I was going from port 81 to the default port):
    UPDATE `wp_options`
    SET `option_value` = replace(option_value , 'http://localhost:81', 'http://localhost')
    

  • How to Fix: WordPress Site not Working on Localhost After Port Change


, , , , , ,

No comments:

Post a Comment

Thanks for commenting !
we will reach you soon .