You could filter the option requests for the host.
In your wp-config.php
below the line …
require_once ABSPATH . 'wp-settings.php';
… add the following lines:
add_filter( 'pre_option_home', 'set_current_host' );
add_filter( 'pre_option_siteurl', 'set_current_host' );
function set_current_host()
{
return 'http://' . $_SERVER['HTTP_HOST'];
}
add_filter()
is not available earlier, and you should keep such code in your wp-config.php
. I don’t know if there are side effect or cases where it doesn’t work. Should not happen, but test it thoroughly.
Related Posts:
- Rewrite default post type
- redirect 301 old url to new url
- Changing WordPress blog name and web address
- How to rewrite url wordpress?
- How do I retain url parameters the entire time a user browses my site?
- How to achieve my custom post url structure?
- wordpress url correction
- Redirect htaccess [closed]
- Replace “http://localhost:8888/” by website URL in WordPress
- Two sets of url one content?
- change the url in wordpress
- Get logged in username in wordpress url
- URL problem: www.sitename.com/blog and www.sitename.com/learn using same WP installation
- how to move another machine or server without dealing with IP
- loading images, css and fonts from site url
- WordPress is adding “category” word before my actual category name in url (and this is unsolicited)
- WP returns to domain root instead of siteurl
- Homepage cannot be found
- Error 404 wordpress redirecting URL
- How to retrive previous Domain URL in Wp
- Lost WordPress website access after changing URL [closed]
- WordPress is adding pagination for all pages like www.example.com/page/123. How to remove that?
- How do you create a “virtual” page in WordPress
- Rewrite rules not working in WordPress
- rewrite rules and querystring
- Getting the Site URL Including the Front Base
- How to prevent redirection to max 2147483647 for larger values of the page query variable?
- How to create the pseudo static rules of the page I created
- how to add prefix to post url structor only
- How do I remove a word from a url in WordPress using .htaccess?
- Rewrite Rule for Custom Page with Query Vars in URL
- wp_sanitize_redirect strips out @ signs (even from parameters) — why?
- WP Rewrite the last two parts of the URL
- Rewrite URL to remap WordPress Permalink
- WordPress redirection to get url friendly
- Access $_POST data after redirect
- How to add a custom redirect rule for subdomains?
- How to remove WordPress category from URL and have a custom pagination parameter/rewrite?
- append url parameters to all links
- Load a template page based on part of slug in wordpress
- Is it possible to rewrite URLs in this situation?
- Using category slug in add_rewrite rule
- Adding pretty query parameters
- How to change the main site url on a multisite installation (network)?
- Problem with add_rewrite_rule
- add_rewrite_rule ignoring other params than the “p” param
- Adding two rewrite rules
- Load an url with minimal/no DB queries
- .htaccess rewrite
- Auto generate rewrite rules for multiple taxonomies
- Generating a Rewrite Rule for sSecific Post-Requests from a Submitted Form?
- Change htaccess to redirect to index.php in subfolder
- rewrite url for authors
- How to redirect specific URL to Subdomain
- How to rewrite wordpress urls with index.php in them
- Force search form to go to clean url without multiple redirects
- Rewrite query string to path
- map multiple URLs to display home page without changing URL displayed in browser’s location bar
- WordPress Autocorrect URL / Slugs Does Not Work
- Rewrite URL based on home_url
- Replace term archives with static pages
- Why does my URL rewriting only work using two different methods?
- Using a custom 410 page
- Rewrite vs Redirect from ?p={ID}
- Is it possible to set the same base for categories and tags?
- Adding a rewrite rule to page that has no fixed variables and pagination
- Flush rewrite rules on option update with Settings API
- Integer based rewrite isn’t recognized for value of 1
- Re-directing URLs with dates to URLs without dates
- Help with a custom rewrite
- Not able to rewrite the pagination URL for the posts
- add_rewrite_tag works for some parameters but does not for others
- Rewrite specific action url
- Using URL rewrite to add custom URL for custom post type
- 301 Rewriting htaccess
- Using page as front page, why does /page/### work?
- wordpress path generation from rewrite rule
- How to add dot(“.”) in post slug
- Add www to the Root Site in WP Multisite Network
- Multisite problem with unexisting paths to CSS etc
- WordPress pagination broken for page 2,3 with custom permalink. Redirects to baseurl
- Permalink not changing according to post type
- Rewrite rule for custom permalink structure
- Unable to access the query variables in the template
- Why is there a 404 on page 2+ for my search page?
- Custom rewrite from URL to URL using slug
- URL rewrite before template_redirect called
- Properly maintaining an old rewrite structure
- .htaccess RewriteBase equivalent for WordPress – Passing a URL as a variable without getting a 404
- URL Rewrite for CPT single posts
- Rewriting WordPress URLs
- Need Help With A Rewrite Issue
- Function to rewrite URl in WordPress
- How can i maintain permalink structure and avoid a 404 error when loading external content?
- Can’t get pretty permalinks to work without index.php
- How to rename the WordPress wp-login.php running on IIS6?
- get parameter from url rewrite [closed]
- Spurious URL structure (Adding extra /0/s)
- Programmatically add a custom url route “/category/index.json” to return a collection of posts in json
- WP-Include rewrite directory