Have you ever encountered a case where you want to access your WordPress site from multiple site URLs (for example a local URL and an external URL, or multiple external URLs)?
Solution
Change the Site URL and Home URL to a relative URL, making the domain name irrelevant to loading the site. Oh, but it can’t be as simple as updating that on the Settings->General admin page, no…WordPress requires a valid URL. Well don’t give up, you’ll just have to hack the option directly in the database.
- Connect to your WordPress database using a web-based utility like phpMyAdmin or another SQL client such as HeidiSQL.
- Open your
wp_optionstable for editing (if applicable, use your table prefix instead ofwp_). - Find the rows with an
option_nameofsiteurlorhomeand change theoption_valueof each to/if WordPress is installed in the root of your website or/path/to/wordpressif your WordPress site is installed in a sub-directory. Do NOT add a trailing slash. - For those wanting to execute a simple SQL query, here is an example:
UPDATE wp_options SET option_value = '/' WHERE option_name IN('siteurl', 'home'); - Test your site out by going to your site URLs (for example http://192.168.0.1, http://mywebserver.local, http://www.example.com).
Important Note: This method is a hack and therefore isn’t a behavior WordPress developers intended. I wouldn’t recommend it for a production site. I have noticed that after making this change on a site that the admin login page lacks CSS, the toolbar on the Visual Editor is missing, and the front-end admin bar sometimes fails to be styled and shows at the bottom on pages. I haven’t seen any issues with the normal front-end site that visitors see. So be aware of some admin CSS problems.
Hope that tip can help some of you out, I know it was useful to me.


