Created
August 10, 2012 19:47
-
-
Save hansspiess/3317319 to your computer and use it in GitHub Desktop.
.htaccess: Localhost / Live Server Switch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteBase / | |
# Copy HTTP Authorization header value to HTTP_AUTOHRIZATION server variable for use by script | |
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] | |
# On live server, rewrite requests for URL-paths which do not resolve to specific | |
# physically-existing filetypes to my script, excluding the script's URL-path itself. | |
RewriteCond %{HTTP_HOST} !^localhost$ | |
RewriteCond $1 !^index\.php | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule (^[^.]*|\.(php|html?|feed|pdf|raw))$ index.php [NC,L] | |
# On localhost dev server, rewrite requests for URL-paths which do not resolve to specific | |
# physically-existing filetypes to my dev script, excluding the script's URL-path itself. | |
RewriteCond %{HTTP_HOST} ^localhost$ | |
RewriteCond $1 !^localhost_path/index\.php | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule (^[^.]*|\.(php|html?|feed|pdf|raw))$ localhost_path/index.php [NC,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment