Tips and Tricks Latest Post
Tips and Tricks Latest Post |
How to Fix: WordPress Site not Working on Localhost After Port Change Posted: 30 Sep 2017 04:46 AM PDT If you have installed WordPress on localhost (example: using XAMPP) and then later you need to change the Apache’s HTTP port number, you will find that the existing WordPress installs will stop loading. It will auto redirect to the URL with the old port number and fail to load. Trying to load the WordPress install will result in a 404 error. In this tutorial I will show you how you can easily rectify this issue so you can use the existing WordPress installs after a port change (no need to install WordPress from scratch). Little BackgroundI 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-site install (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 LoadThe reason the site is not loading after the port change is because of the site URL value (that contains the old port number) in the wp_options table. So we are going to update that value to the new port number. Update the WP Database TableHere is how you can fix it by updating the port number value in the database:
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') That should do it. Check the WordPress site and it should be accessible now. |
You are subscribed to email updates from Tips and Tricks HQ. To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States |
No comments: