• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Tips and Tricks HQ

  • Home
  • Blog
  • Projects
    • All Projects
    • Simple WP Shopping Cart
    • WP Express Checkout Plugin
    • WP Download Monitor
    • WP Security and Firewall Plugin
    • WP eStore Plugin
    • WP Affiliate Platform
    • WP eMember
    • WP Lightbox Ultimate
    • WP Photo Seller
  • Products
    • All Products
    • Checkout
  • Support
    • Support Portal
    • Customer Only Forum
    • WP eStore Documentation
    • WP Affiliate Software Documentation
    • WP eMember Documentation
  • Contact

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

You are here: Home / Web Development / How to Fix: WordPress Site not Working on Localhost After Port Change

Last updated: September 30, 2017





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 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-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 Load

The 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 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')

That should do it. Check the WordPress site and it should be accessible now.

Related Posts

  • How to Install WordPress Multi-Site in Localhost (Using XAMPP)
  • How to Uninstall and Reinstall WordPress
  • A Brief Introduction to WordPress Nonces
  • How to Install A WordPress Multi-Site Network [Video Tutorial]

Web Development,  Wordpress apache,  Database,  uninstall,  wordpress developer tutorial,  Wordpress install,  WordPress tutorial

Reader Interactions

Leave a Reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Featured & Popular Articles

Video Answers to Top WordPress QuestionsWordPress Optimization Tips and Tricks for Better Performance and SpeedEssential WordPress Security Tips - Is Your Blog Protected?WordPress Simple PayPal Shopping Cart PluginTop 15 Search Engine Optimization (SEO) Techniques I Forget to DoList of the Best and Must Use WordPress PluginsHow do I Start a Blog and Make Money Online?Good Domain Name Picking Tips for Your Blog SetupFind Out Which WordPress Web Hosting Company Offers the Cheapest and Reliable Web Hosting Solution

Featured WordPress Plugins

wordpress estore plugin
wordpress membership plugin
WP Express Checkout Plugin
WordPress Lightbox Ultimate Plugin
WordPress photo seller plugin
wordpress affiliate plugin

Recent Posts

  • Accept Donations via PayPal from Your WordPress Site Easil [...]
  • Buy Now Button Graphics for eCommerce Websites [...]
  • Subscription Button Graphics for eCommerce Websites [...]
  • Adding PayPal Payment Buttons to Your WordPress Sidebar Ea [...]
  • PayPal QR Codes [...]

Comment & Socialize

  • @Rodrigo Souza, Thank you f ...
    - admin
  • The example for 'slm_add_ed ...
    - Rodrigo Souza
  • @Ron, All the valid transac ...
    - admin
  • Hello, when people have sel ...
    - Ron
  • We have hte following featu ...
    - admin

Check out our solutions

View our WordPress plugin collection and start using them on your site.

Our WordPress Solutions

Footer

Company

  • About
  • Privacy Policy
  • Terms and Conditions
  • Affiliate Login

Top WordPress Plugins

  • Simple Shopping Cart
  • PayPal Donations
  • WP Express Checkout
  • WP eStore
  • WP eMember

Blogging Tips

  • How to Start a Blog
  • Selecting a Good Domain
  • Cheap WP Hosting
  • WP Video Tutorials
  • Simple SEO Tips

Search


Keep In Touch

Copyright © 2023 | Tips and Tricks HQ