I run a few Virtual Host instances on Apache that are assigned different port numbers. For example, the dev instance of this site was hosted on
On a new WordPress installation, if I hit
http://localhost:8080/ on a browser, I will get a HTTP 301 redirect to
http://localhost/ (sans port number) because of the built-in Canonical URLs feature. As you can probably tell, I wasn’t able to access the WordPress instance on port
Fortunately, Mark Jaquith has provided an aptly named Disable Canonical URL Redirection plugin.
Drop the plugin into your
wp-content/plugins directory and we will then need to activate it outside the admin area by fixing the database directly (I used Sequel Pro). Here’s how:
- Locate the
- Change the values of
/(might not be strictly necessary)
http://localhost:8080/ should now work correctly.
Just remember to disable/remove the plugin in production environment. The SQL values you just fudged would be correctly resaved once you have access to the admin section.