14

First of all I installed wamp server on port 8081 (Because there was IIS on 80). the word process was installed successfully and blog was running smoothly. Now I stopped the IIS and set the apache port to 80. But the application is redirecting to port 8081. (Also I copid the wordpress folder to my live domain, in there also it is redirecting to port 8081.) In which file, I need to change the port number? (I have already changed the port number in httpd.conf.)

Thank You in Advance. :)

Jack Bonneman
  • 1,821
  • 18
  • 24
Keshab
  • 226
  • 2
  • 3
  • 14

6 Answers6

14

I had an issue where the original port I had specified when I installed WP was changed. I couldn't log into wp-admin because WP kept redirecting to the old port. I used phpMyAdmin to edit the wp_options table. Both the siteurl and home records used the old port. With phpMyAdmin, you can edit cells directly without having to export/import. I thought I'd add this as an answer just in case it helps someone else down the road.

Or use a SQL like this:

update wp_options SET option_value = 'http://your-domain/wordpress:new-port' where option_id = 1 and option_name = 'siteurl';

update wp_options SET option_value = 'http://your-domain:new-port/wordpress' where option_id = 2 and option_name = 'home';
Marcio Jasinski
  • 1,439
  • 16
  • 22
Michael Sobczak
  • 1,045
  • 1
  • 24
  • 45
  • In the SQL section, why do you setup the URL to be site_root :new-port in the first case and site_root:new_port/wordpress in the second. What directory is wordpress/ in both case? – pensebien Aug 06 '20 at 07:54
11

Go to Dashboard > Settings > General and check what you have for the options:

  • WordPress Address (URL)
  • Site Address (URL)
user850010
  • 6,311
  • 12
  • 39
  • 60
7

I found same problem but I'm using xampp.

Scenario I have setup another new server using xampp in a different port (8090), then I transferred the existing WordPress to the new server but it was still keeping redirection to the original port.

Solutions Updated the option_value in the table wp_options in mysql to the new port. Here is an example updated query.

UPDATE `wordpress`.`wp_options`
SET
`option_value` = 'http://localhost:8090/wordpress'
WHERE `option_id` = 1 or `option_id` = 2;
KHACHORNCHIT
  • 2,222
  • 23
  • 19
2

If you just want to do it quickly you can change the values in the database. Connect to the [mysql] db for your blog and update the values in the wp_options table.

    # mysql -u root -p

    > use [yourWordpressDBName]

    >    UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl.com:80','http://www.newurlcom:8080') WHERE option_name = 'home' OR option_name = 'siteurl';

And then connect in your browser- the url is changed!

I had to do this to get a 2nd docker instance of WP working on a different port on the host.

Andy D
  • 896
  • 7
  • 12
0

Go to your phpmyadmin and inside your database you will see wp_options open it and edit the port

Kipruto
  • 721
  • 6
  • 16
0

If none of the answers works consider checking your .htaccess file.

MeSo2
  • 450
  • 1
  • 7
  • 18