Skip to content

Instantly share code, notes, and snippets.

@hugocf
Last active August 29, 2015 13:55
Show Gist options
  • Save hugocf/8707432 to your computer and use it in GitHub Desktop.
Save hugocf/8707432 to your computer and use it in GitHub Desktop.
Dynamic local “.dev” site mapping for Apache & WordPress
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# Dynamic virtual hosting
#
# http://some.example.dev => /Users/username/Sites/example
<VirtualHost *:80>
VirtualDocumentRoot "/Users/username/Sites/%-2"
ServerName default.dev
ServerAlias *.dev
</VirtualHost>
# http://some.example.10.0.0.1.xip.io => /Users/username/Sites/example
<VirtualHost *:80>
VirtualDocumentRoot "/Users/username/Sites/%-7"
ServerName xip.io
ServerAlias *.xip.io
</VirtualHost>
# http://codex.wordpress.org/Editing_wp-config.php#Advanced_Options
define( 'WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] );
define( 'WP_HOME', 'http://' . $_SERVER['SERVER_NAME'] );
# http://andrewnacin.com/2010/04/23/5-ways-to-debug-wordpress/
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true ); # error_log("debug message");
define( 'WP_DEBUG_DISPLAY', false );
define( 'SCRIPT_DEBUG', true );
define( 'SAVEQUERIES', true );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment