summaryrefslogtreecommitdiff
path: root/core/helpers
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2008-12-16 08:17:00 +0000
committerBharat Mediratta <bharat@menalto.com>2008-12-16 08:17:00 +0000
commit3e219aab6ba88738832627ac39a3b3249f0ce2c3 (patch)
tree51607cdf0d3cd2cb890bcab57e942f72de0cbf78 /core/helpers
parent8bd7afeb5b98cda47fce9df8a32ce85d9ef1a173 (diff)
Change htaccess rules to use mod_rewrite
Diffstat (limited to 'core/helpers')
-rw-r--r--core/helpers/access.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/helpers/access.php b/core/helpers/access.php
index eda91d65..f2949528 100644
--- a/core/helpers/access.php
+++ b/core/helpers/access.php
@@ -468,9 +468,16 @@ class access_Core {
*/
private static function _create_htaccess_files($album) {
foreach (array($album->file_path(), dirname($album->resize_path())) as $dir) {
+ $base_url = url::site("file");
$fp = fopen("$dir/.htaccess", "w+");
- fwrite($fp, "Order Deny,Allow\n");
- fwrite($fp, "Deny from All\n");
+ fwrite($fp, "<IfModule mod_rewrite.c>\n");
+ fwrite($fp, " RewriteEngine On\n");
+ fwrite($fp, " RewriteRule (.*) $base_url/\$1 [L]\n");
+ fwrite($fp, "</IfModule>\n");
+ fwrite($fp, "<IfModule !mod_rewrite.c>\n");
+ fwrite($fp, " Order Deny,Allow\n");
+ fwrite($fp, " Deny from All\n");
+ fwrite($fp, "</IfModule>\n");
fclose($fp);
}
}