directoryindex

How to allow downloading files with PHP, but deny direct access to directory listings

a 夏天 提交于 2019-12-23 05:27:39
问题 I am using Apache on my server and I'd like to allow my visitors to download resources free of charge. However, to preserve even a little bit of bandwidth I'd like to deny direct access to the root folder of the resources like this: www.myhost.com/resources/file.wav If the visitor removes file.wav from the URL, they have access to all sounds at once and thus I'd have people just downloading like crazy. I don't want that. How can I stop the users from going into that root directory, and any

Redirect Users based on IP Address | Apache / htaccess

一世执手 提交于 2019-12-12 03:03:10
问题 I'd like to redirect users to an /index/ area of the site if they don't have my IP address. How do I do this? Thank you. 回答1: The mod_rewrite way: RewriteEngine on RewriteCond %{REMOTE_ADDR} ^123\.45\.67\.[8-9]$ # your ip here RewriteCond %{REQUEST_URI} !^/index/ RewriteRule .? /index/ [R,L] 回答2: Is this what you're looking for? if($_SERVER['REMOTE_ADDR'] != 'xxx.xxx.xxx.xxx') { header('Location: /index/'); } You can specify an array that matches against allowed IPs. if(!in_array($_SERVER[

Application of DirectoryIndex to an Alias in Apache

我只是一个虾纸丫 提交于 2019-12-11 03:21:55
问题 How does one apply DirectoryIndex to an Alias in Apache without resulting in error 403? This results in response header 200: http://localhost/ Which presents http://localhost/index.html <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www DirectoryIndex index.html index.php index.xhtml index.htm default.htm <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny

htaccess directoryindex redirect looking for css wrong place

流过昼夜 提交于 2019-12-11 01:11:59
问题 Hello in my htaccesss file i put this code to ensure that my directory index file is set to v2013/index.html so i put this code DirectoryIndex v2013/index.html Then i Want it to look like mydomain.com/Welcome, so i add.. RewriteEngine On RewriteRule ^Welcome$ v2013/index.html [L] My question is why DirectoryIndex not working anymore.. and how can i tell the browser to look for the css inside v2013, because is looking in the root. ( i think because of rewrite) SO MY PAGE IS UNSTYLE.. =( In

Apache lists directory files instead of index.php

蹲街弑〆低调 提交于 2019-12-07 05:01:17
问题 My Apache web server suddenly stopped serving index.php files automatically. It shows direcotry listing instead. I've tried helps but no luck. My htttpd.conf file includes <IfModule module_php5> AddType application/x-httpd-php .php </IfMOdule> and DirectoryIndex index.php index.html What could be wrong if all above are OK? 回答1: I was surprised by the quick response when I first asked the question, and then the replies stopped! So I found the answer myself (by accident!). The main server root

Apache lists directory files instead of index.php

筅森魡賤 提交于 2019-12-05 07:54:41
My Apache web server suddenly stopped serving index.php files automatically. It shows direcotry listing instead. I've tried helps but no luck. My htttpd.conf file includes <IfModule module_php5> AddType application/x-httpd-php .php </IfMOdule> and DirectoryIndex index.php index.html What could be wrong if all above are OK? I was surprised by the quick response when I first asked the question, and then the replies stopped! So I found the answer myself (by accident!). The main server root displayed index files fine, it was my user Sites folder that did not. There is a .conf file for each user in

apache not returning index.php as default

此生再无相见时 提交于 2019-12-02 14:18:20
问题 I recently made a DigitalOcean droplet with LAMP pre-installed. Went and uploaded my website (including index.php) to /var/www Apache just returns the It Works! page, I have to manually add /index.php to my url Things I have tried: Made an .htaccess file containing "DirectoryIndex index.php" Adding DirectoryIndex index.php to apache2.conf Set index.php first in dir.conf Making an index.html, didn't show that either. EDIT: here's my apache2.conf file: http://pastebin.com/BMgiNdiD 回答1: You are

apache not returning index.php as default

寵の児 提交于 2019-12-02 08:58:51
I recently made a DigitalOcean droplet with LAMP pre-installed. Went and uploaded my website (including index.php) to /var/www Apache just returns the It Works! page, I have to manually add /index.php to my url Things I have tried: Made an .htaccess file containing "DirectoryIndex index.php" Adding DirectoryIndex index.php to apache2.conf Set index.php first in dir.conf Making an index.html, didn't show that either. EDIT: here's my apache2.conf file: http://pastebin.com/BMgiNdiD You are missing following configuration: # # DirectoryIndex: sets the file that Apache will serve if a directory #

VirtualHost with wildcard VirtualDocumentRoot

二次信任 提交于 2019-11-28 17:39:34
I'm trying to create a fallback for my virtual hosts. My configuration looks like this: # Fetch all pre-defined hosts Include "conf/extra/vhosts/*.conf" # Fallback NameVirtualHost *:80 <Directory "C:/LocalServer/usr"> Options Indexes FollowSymLinks Includes AllowOverride All Order allow,deny Allow from all </Directory> <VirtualHost *:80> VirtualDocumentRoot "C:/LocalServer/usr/%-1/projects/%-2+/public/" </VirtualHost> The objective here is the following: If I try to access http://test.lab/ , I want it to automatically pick up the following directory: C:/LocalServer/usr/lab/projects/test/public

VirtualHost with wildcard VirtualDocumentRoot

主宰稳场 提交于 2019-11-27 10:40:28
问题 I'm trying to create a fallback for my virtual hosts. My configuration looks like this: # Fetch all pre-defined hosts Include "conf/extra/vhosts/*.conf" # Fallback NameVirtualHost *:80 <Directory "C:/LocalServer/usr"> Options Indexes FollowSymLinks Includes AllowOverride All Order allow,deny Allow from all </Directory> <VirtualHost *:80> VirtualDocumentRoot "C:/LocalServer/usr/%-1/projects/%-2+/public/" </VirtualHost> The objective here is the following: If I try to access http://test.lab/ ,