You need to set the WP_HOME and WP_SITEURL in wp-config.php
in a smarter way. Like this:
<?php
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);
// add the next line if you have a subdirectory install
define('WP_SITEURL', WP_HOME . '/path/to/wordpress');
This will solve your your issues with site URLs as they will be set dynamically on based on whatever the hostname is. This is the correct way to do this — it’s something I do on virtually ever WP install and it’s even in the codex. Believe me, you don’t really want relative urls.
Related Posts:
- How to remove “http://” When Echoing URL?
- Unable to load static front page on home url
- Remove site root trailing slash
- home_url(); showing current page instead of site address
- Remove / from www.example.com/ [closed]
- Components used in Themes and Plugins: How to get file URL?
- What is the correct way to convert the absolute path of the executing script to a URL, in WordPress?
- How do I test my localhost WordPress project with VirtualBoxVM?
- Showing my server ip in source code for several links not for all links
- Cannot access WordPress website from external IP while internally it is working properly [closed]
- Relative URLs within site
- bloginfo no show the right path
- Making a site URL
- Accidentally Changed WordPress Url
- My Website’s Main URL redirects me to an Archive Page
- Custom plugin route in WordPress
- Why is ?doing_wp_cron being appended to my URLs
- Change default URL path (/blog/) of blog posts
- How to deal with WordPress on localhost
- How to convert the file path to a URL of the same file?
- Why is WordPress saving full-urls to the database?
- Get taxonomy slug from url
- Load images with http urls inside https post
- Force the Website URL to Include “www” and to be Upper Case?
- WordPress and $_GET Params
- Why WP encodes UNICODE (UTF8) containing urls? Any drawbacks of UNICODE url?
- Force home page to be https?
- add_query_arg() One Key with multiple values
- Change homepage url
- How to update media links in WordPress after migration?
- Check what is at URI (post, archive, etc…)
- How can I change all links on pages to point to a different domain from where the site is hosted?
- Why ids in urls don’t work but slugs do?
- Changing my site url from azure.net to custom domain
- How to show the homepage on a different url, like site.com/blog instead of site.com?
- Check request URL for pattern
- Rewrite WordPress Standard Feed URL – /feed/ to feed.xml
- Set a custom URL for image in the Media Library?
- How to edit URL Slug?
- Check if user is logged in to site A when visiting site B
- Publish Post when URL is available else reschedule the post in wordpress [duplicate]
- Change url links on members loops in buddypress
- Find file url in post content and add it to media library
- Localhost port is missing on some links after downgrading MAMP [closed]
- rewrite taxonomy-{taxonomy}-{term}.php terms
- Why am I seeing all these weird ‘loginid’ requests?
- Confusion about Site url and directory
- Multiple URLs with Numbers
- Moved WP into new folder. How to fix image links in posts?
- Will get_bloginfo(‘url’) return URL with backslash?
- Using esc_url_raw with protocols properly
- How to parse a custom url (within WP site) and obtain params passed to that URL
- How can I identify which file/function will be used to respond to a particular URL?
- Is there a way to test if a URL is part of the current blog?
- wordpress copyright dynamic
- Could not find the wordpress page
- Multiple duplicate URL’s
- An anchor name (id name) in the address bar
- Dynamic URL and pass the data to an iframe
- DNS – Change WordPress Site Name?
- get_template_directory() returns wrong address on VPS
- Unnecessary url
- How to close tab automatically if URL has specific word? [closed]
- Finding URI in Child Theme
- Image not showing up in media loader success area – followup
- How do I allow http/ftp access to files I have uploaded?
- Redirecting URL with Twitter Button API Not Working
- Need help changing back the correct wordpress url
- Adding Parent Categories and keep current URLs
- Sanitizing URL in a WordPress plugin
- How to display translated content with custom slug?
- Different url to same page (with dynamic content)
- WordPress option com_jce should not work
- Too many redirects (ERR_TOO_MANY_REDIRECTS) only on one page
- WordPress Still Requesting Old Url
- Broken Images and Style
- Add more than one query parameter onto wordpress url
- WordPress Website change directory
- i1.wp.com url problem (Jetpack not installed)
- Change dynamically URL to SEO friendly via .htaccess?
- incorrect url in Snippet editor
- Get userdata from url
- How to make url variable?
- WordPress Address (URL) Reverts back
- Modify the WordPress URL
- Duplicate pages with ?s parameter
- Populate Website URL at registration time
- WordPress Update Links
- wordpress url with format .com/category/sub-category
- URL Forwarding – wordpress links reverting back
- How to use query string in URL to display content on the wordpress page
- help me remove this additional parameter in url
- Function to get custom post image URL
- How to echo a dynamic url
- Lost WordPress website access after changing URL [closed]
- How to run Wiki on the same host as WordPress and not get 404 errors when browsing to Wiki?
- Replace media external links with local links
- WordPress rewrites my link with custom URL scheme to http(s)
- Show page name after home url
- how to add param string after website url in wordpress?