My local setup for WordPress is at

When calling https://my.domain.name/blog/wp-login.php, I get the page served; including Google CAPTCHA. But the login post to a 302 redirect to

In order to overwrite my server default domain I added locally this to my wp-config.php file:


In my Fiddler Web Debugger script I am using the following code to redirect my browser to go to my local setup:

if (oSession.HostnameIs("my.domain.name")){
    oSession.bypassGateway = true;
    if (oSession.HTTPMethodIs("CONNECT")){
        oSession["x-replywithtunnel"] = "FakeTunnel";
    oSession["x-overrideHost"] = "";
    oSession.fullUrl = "" + oSession.PathAndQuery;

How can I get WordPress returned page to be rewritten before it gets sent to the browser, so it changes all to my.domain.name?

-- OR --

Is there a smarter way to go about all of this within WordPress?

I had a look at Change WordPress image URLs via filter because it is somewhat related, but could not figure it out.

  • Could you not tell WP its URL is my.domain.name then adjust your hosts file? WP doesn't need to know its IP is
    – Tom J Nowell
    Oct 7, 2020 at 16:24
  • @TomJNowell I have a multi site setup and did not want to set a my.domain.name URL in wp-config.php.
    – MeSo2
    Oct 7, 2020 at 16:51
  • you don't need to set the domain name in wp-config.php, I have multiple separate multisite installs running locally here, and WP is unaware of the IP it's serving from, and I don't set the URL in wp-config.php. I just set each site in a multisite to the desired domain and WP handles it fine. Settings the domain and site URLs in wp-config.php is unnecessary. The only thing I can forsee is that Fiddler doesn't know how to route the requests to WordPress but that's a Fiddler problem not a WP problem. TLDR: Just use real URLs in your WP installs
    – Tom J Nowell
    Oct 7, 2020 at 16:57
  • @TomJNowell I tried all kind of combinations, and nothing really worked the way I wanted it to work. By using Fiddler as described in my answer WordPress finally loads. And if I want to dump the live database onto the local database I can just copy it over, no need to do anything more to get it back up.
    – MeSo2
    Oct 7, 2020 at 19:04

1 Answer 1


I added this to Fiddler's script in %USER%\Documents\Fiddler2\Scripts\CustomRules.js under OnBeforeResponse and the response rewrite started working

 static function OnBeforeResponse(oSession: Session) {
        if (m_Hide304s && oSession.responseCode == 304) {
            oSession["ui-hide"] = "true";
        if (oSession.oResponse.headers.ExistsAndContains("Content-Type","text/html")){

and needed to set

// define('WP_HOME','');
// define('WP_SITEURL','');

in wp-config.php

In order to be able to log in I also had to remove the plugin simple-google-recaptcha. There might be a way to set it up with reCAPTCHA not needing to be deactivated, but for now this is all I need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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