Skip to content

Instantly share code, notes, and snippets.

@mikaelz
Created July 8, 2016 09:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikaelz/77026af5fe931278340373efc4ee7662 to your computer and use it in GitHub Desktop.
Save mikaelz/77026af5fe931278340373efc4ee7662 to your computer and use it in GitHub Desktop.
Different RewriteBase on localhost for WordPress Rewrites
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^localhost$
RewriteRule . - [E=REWRITEBASE:/example.com/]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . %{ENV:REWRITEBASE}/index.php [L]
</IfModule>
# END WordPress
RedirectMatch 301 /wp-content/uploads/(.*)$ http://www.example.com/wp-content/uploads/$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment