Skip to content

Instantly share code, notes, and snippets.

@pmgarman
Forked from nickdavis/gist:10525079
Last active March 15, 2022 04:18
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pmgarman/8fba357c97193633a66d to your computer and use it in GitHub Desktop.
Save pmgarman/8fba357c97193633a66d to your computer and use it in GitHub Desktop.
# Apache .htaccess
RedirectMatch 301 ^/wp-content/uploads/(.*) http://livewebsite.com/wp-content/uploads/$1
# Nginx
location ~ ^/wp-content/uploads/(.*) {
rewrite ^/wp-content/uploads/(.*)$ http://livewebsite.com/wp-content/uploads/$1 redirect;
}
@mgratch
Copy link

mgratch commented Apr 26, 2019

Using Browsersync with Valet and Nginx

In order to use Browsersync with Valet & Nginx you will need to add proxy_* settings to your root location block. There should already be a rewrite ^ there pointing to server.php. The Proxy settings will go underneath the rewrite setting. Like so:

    location / {
        rewrite ^ /home/username/.config/composer/vendor/valeryan/valet-wsl/server.php last;
        proxy_pass          https://localhost:3000;
        proxy_set_header    Host             $host;
        proxy_set_header    X-Real-IP        $remote_addr;
        proxy_set_header    X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header    X-Client-Verify  SUCCESS;
        proxy_set_header    X-Client-DN      $ssl_client_s_dn;
        proxy_set_header    X-SSL-Subject    $ssl_client_s_dn;
        proxy_set_header    X-SSL-Issuer     $ssl_client_i_dn;
        proxy_read_timeout 1800;
        proxy_connect_timeout 1800;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment