0

I recently had to upload my wordpress website from live host (cpanel) to my localhost. (Took database from cpanel and updated it and changed the url settings in my database) Now when im entering the url http://localhost:8080/xxx/ the page url redirects to http://localhost/xxx/ and is showing an error. I can visit http://localhost:8080/xxx/wp-admin and all my pages but the home url/redirect is broken.

Anyone know why this happening?

0

Try to look in your wp-config.php for the siteurl. Maybe this gives some inspiration? Im a newb in wordpress but maybe this will help?

  • Tried this already without any affect. Thanks though – Dennis Jun 6 at 7:25
0

Add this to your htaccess file.

RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^ http://%{HTTP_HOST}:8080%{REQUEST_URI} [P]

This will redirect any port 80 request to port 8080. Place in the root folder of your site.

You could also put the port 80 in your site URLs in the wp-options table. Use like http://localhost:8080 , adjusting as needed.

(Note; you could change the URLs in the wp-config.php file, but I'm not a big fan of that. Although I might be convinced to put the 'live' URL in the wp-options table, and then overriding that on your dev system by setting those values in the wp-config.php on the dev system. As long as you don't transfer the wp-config.php file to production.)

  • Tried all these options without affect. Still redirects to the error.. It's strange because all my other sites on my server still works 'without' these rules. – Dennis Jun 6 at 7:25
  • If the URLs in wp-options table point to example.com:8080 , that will be the prefix that WP should use to create links. And then the rewrite rule should rewrite any requests to port 80 (default) to port 8080. So a double-protection. Don't understand why not doing both of those things didn't work for you. (You need both.) – Rick Hellewell Jun 6 at 18:11
  • I tried to reupload my DB at home again and suddenly its working.. Strange but im happy.. – Dennis Jun 11 at 6:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.