Skip to content

Instantly share code, notes, and snippets.

@tylerhall
Created April 21, 2013 20:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tylerhall/5431032 to your computer and use it in GitHub Desktop.
Save tylerhall/5431032 to your computer and use it in GitHub Desktop.
Modified WordPress index.php to work with any domain name.
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);
$s = empty($_SERVER['HTTPS']) ? '' : ($_SERVER['HTTPS'] == 'on') ? 's' : '';
$port = ($_SERVER['SERVER_PORT'] == '80') ? '' : (":".$_SERVER['SERVER_PORT']);
$url = "http$s://" . $_SERVER['HTTP_HOST'] . $port;
define('WP_HOME', $url);
define('WP_SITEURL', $url);
unset($s, $port, $url);
/** Loads the WordPress Environment and Template */
require('./wp-blog-header.php');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment