Created
April 23, 2013 15:30
-
-
Save shrwnsan/5444567 to your computer and use it in GitHub Desktop.
Proper DOCUMENT_ROOT when using mod_vhost_alias. Source http://jbenner.net/blog/quick-tip-get-proper-document-root-when-using-mod-vhost-alias
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
// Note: httpd-vhosts.conf filename just used as an example. | |
// Add the following line to your apache configuration inside the VirtualDocumentRoot vhost definition | |
// E.g. | |
// <VirtualHost *:80> | |
// ... | |
// {paste here} | |
// </VirtualHost> | |
php_admin_value auto_prepend_file "/Users/USERNAME/Sites/setdocroot.php" |
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
<?php | |
apache_setenv("DOCUMENT_ROOT", | |
$_SERVER['DOCUMENT_ROOT'] = str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['SCRIPT_FILENAME']) | |
); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment