Last active
August 29, 2015 14:18
-
-
Save Javvadilakshman/3de06f94b1a6a76571cb to your computer and use it in GitHub Desktop.
.htacces Snippets
This file contains hidden or 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
| RewriteEngine On | |
| DirectoryIndex index.php |
One of the lessor known and used capabilities of .htaccess files is the ability to prepend and append includes to every page request. Doing so avoids needing to code in every template file you wat to use them in. Here's the .htaccess code:
<?php require('footer.php'); ?>
php_value auto_prepend_file "/dir/path/utilities.php"
php_value auto_append_file "/dir/path/templates/footer.php"
RewriteEngine On
RewriteCond %{HTTP_HOST} ^demos.9lessons.info$ RewriteCond %{REQUEST_URI} !^/demos/ RewriteRule (.*) /demos/$1
RewriteEngine On
RewriteCond %{HTTP_HOST} ^labs.9lessons.info$ RewriteCond %{REQUEST_URI} !^/labs/ RewriteRule (.*) /labs/$1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment