Tech Tips on Computers, Internet, Blogging, Web Development, Social Media, Android and more

Full width home advertisement

Post Page Advertisement [Top]

WordPress not opening on localhost:8080 after port change from 80 to 8080
Opening a WordPress site after Apache port change returns HTTP 404 error (Not Found). This is a common issue with  WordPress users who have installed WordPress on local machine, then had to change the Apache HTTP port since other programs took over the HTTP port 80.

Here is a scenario for the issue:

1. XAMPP installed and configured. Apache web page is opening on http://localhost (default port 80)
2. Sites have been developed and placed under /htdocs including say, Drupal and WordPress sites.
3. Drupal and WordPress sites are working fine, and can be accessed on http://localhost/sitename

Now, suppose I needed IIS on the same machine for ASP developments. IIS is installed and it takes over the HTTP port 80. Or even Skype for that matter. Since, IIS takes over the default HTTP port 80, the Apache HTTP for changed or updated.(See here how to run IIS and Apache on the same computer or how to change the HTTP port for Apache)

4. Apache HTTP listen port is now changed from 80 to 8080 in Apache's httpd.conf file. (See here: How to run Apache and IIS on the same computer)

5. Checked Apache service is starting with no issues using 8080 in the XAMPP Control Panel and the Apache default page opens, now at http://localhost:8080

6. Tested each site one by one - whether they are accessible using the new port 8080.

In my case, all other sites including Drupal sites, seems to embrace the port change well. They can be opened on the new port 8080 by accessing from the URL http://localhost:8080/sitename but not WordPress sites.

After the port change, accessing WordPress sites using the url http://localhost:8080/sitename redirects to http://localhost/sitename. The browser returns HTTP 404 (Not found) error.

wordpress localhost 8080 redirect to localhost 404 error

How to make WordPress sites work after changing Apache's HTTP port?

I haven't really dug in to see why WordPress will not work after the port change, but since the WordPress sites were working fine on port 80, but not on the new port 8080, I apply the same steps like I do when moving WordPress sites from local development having port 8080 to live server, that is, localhost URL edits. 

The below steps are also required when moving WordPress site from local machine to live server, if local machine is using port 8080 for Apache.

1. Access phpMyAdmin: http://localhost:8080/phpmyadmin and log in.
2. Click on the particular WordPress site's database.
3. Export it as SQL
4. Open the exported SQL file in a note editor (such as Notepad ++)
5. Do a Find & Replace:

Find = localhost
Replace = localhost:8080

6. Replace All
7. Save as: Save the file as a new SQL file
8. Back in phpMyAdmin:
phpMyAdmin > structure > select all the tables and drop it.

[If the edited SQL backup taken earlier is imported without dropping the tables, we get duplicate primary key error due to existing content.]

9. Import the edited SQL backup file
10. Check the WordPress site is accessible from the url http://localhost:8080/sitename

The WordPress site should now be accessible.

wordpress open on localhost 8080

Hope it helps.
Leave me your comments and queries. Cheers!

10 comments:

  1. Just what I needed. Thank you very much for sharing your experience.

    ReplyDelete
    Replies
    1. @Markus:
      Thanks for the comment. And I am glad it was helpful to you.
      Cheers!

      Delete
  2. Worked for me as well. Thank you very much! :)

    ReplyDelete
    Replies
    1. Hi,
      Thanks for the comment. I am glad it helped.

      Delete
  3. @Markus,
    Hi, seemed to work, though, I was told to make a repair of the database and I did that.
    However, after the repair I try to get to log-in, but it is just "waiting for localhost"
    Any advice?

    ReplyDelete
  4. Solved the above. Just had to restart pc. Many thanks for sharing.

    ReplyDelete
    Replies
    1. Hi,
      I am glad you solved the issue. Cheers!

      Delete
  5. Thnx worked out for me..

    ReplyDelete
  6. I spent 3 hours scouring the internet today for a solution and this is exactly what I needed. Thanks!

    ReplyDelete

Bottom Ad [Post Page]