.htaccess override IndexIgnore *, IndexIgnore nothing - .htaccess

I have a directory with an .htaccess file having the setting IndexIgnore *. How can I set a subdirectory to not ignore anything, or to ignore the negation of everything, so as to override the parent directory's IndexIgnore? Like IndexIgnore ^*, only a working version thereof?

Simply add IndexIgnoreReset ON before the new IndexIgnore directive.
And then, to show everything in the sub folder use IndexIgnore "."
Check the documentation at:
IndexIgnoreReset

I don't think it will be possible because IndexIgnore list is always appended in the existing list (from parent .htaccess). There is now way to overwrite this directive AFAIK.

In <Directory> block you can add:
IndexIgnoreReset ON
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
This will override config for this specific <Directory>

Related

Allow indexing subdirectories but not root directory

I have a site where subdirectories are generated automatically, and need to be indexable under .htaccess
However, I don't want someone to be able to go to the root of these subdirectories and to view them all. I also don't want anything other than these subdirectories to be indexable.
E.g.
/ ~ Has "Options -Indexes" (Non-Indexable)
/foo/ ~ Has "Options -Indexes" (Non-Indexable)
/foo/bar/ ~ Has "Options +Indexes" (Indexable)
/foo/baz/ ~ Has "Options +Indexes" (Indexable)
It's not possible for me to generate an individual .htaccess file for every subdirectory individually, the system I'm using doesn't support it.
I'm assuming there's no other way to solve this problem (without possibly using the Apache config), so I'm just allowing the index recursively (i.e. from /foo), then inside /foo 's .htaccess file:
Options +Indexes
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/foo[/]?$
RewriteRule (.*) / [R=301,L]
To just redirect people to the homepage. Also put a meta refresh redirect in there just incase.

simple "Up a directory" button in htaccess?

a while ago i was using htaccess to display some files, and recently i started that project again and found i had somehow deleted the "go up a level" button back then.
Can anyone tell me what the code line in htaccess looks like to get this button back? Should be relatively simple but i just cant find it... heres what i got.
Options +Indexes
# DIRECTORY CUSTOMIZATION
<IfModule mod_autoindex.c>
IndexOptions IgnoreCase FancyIndexing FoldersFirst NameWidth=* DescriptionWidth=* SuppressHTMLPreamble
# SET DISPLAY ORDER
IndexOrderDefault Descending Name
# SPECIFY HEADER FILE
HeaderName /partials/header.html
# SPECIFY FOOTER FILE
ReadmeName /partials/footer.html
# IGNORE THESE FILES, hide them in directory
IndexIgnore ..
IndexIgnore header.html footer.html icons
# IGNORE THESE FILES
IndexIgnore header.html footer.html favicon.ico .htaccess .ftpquota .DS_Store icons *.log *,v *,t .??* *~ *#
# DEFAULT ICON
DefaultIcon /icons/generic.gif
AddIcon /icons/dir.gif ^^DIRECTORY^^
AddIcon /icons/pdf.gif .txt .pdf
AddIcon /icons/back.png ..
</IfModule>
Options -Indexes
Okay found the problem, it was simple, just not very observant when looking at the code. The line "IndexIgnore .." roughly in the middle.

disable .php and .html files from my directory listing?

How can I disable .php and .html files from my directory listing?
When someone visit my directory
http://example.com/dir
All other files except .php and html should be listed.
Add the following line to your .htaccess file
IndexIgnore *.html *.php
This tells the Apache web server to list all files except those that end with .php and .html .
If you want to disable all files and directories form listing ,Add this line to your .htaccess
IndexIgnore *
The wildcard '*' means it will not display any files

htaccess remove index.php?page=

I currently have urls that look like: something.com/index.php?page=pagename
we would like to have it just be something.com/pagename
But still be able to access sub folders like something.com/admin/
Thanks in advance.
If you're using Apache, which I presume you are, you need to use the ReWrite Engine:
If you don't have one already, create or add to the .htaccess file stored in the root directory you're rewriting. So you if you want something.com/index.php?* to rewrite, then use put it in the folder where something.com is stored.
There, you need something like:
RewriteEngine On
RewriteRule ^([^/]*)$ /index.php?topic=$1 [QSA,L]
This regex takes the beginning of the input after "/", and uses that input as the variable $1.
Source: http://www.generateit.net/mod-rewrite/
You then change all your links to point to "/pagename"
You may also have to turn on the RewriteEngine module by uncommenting it in your httpd.conf file by finding the line like:
#LoadModule rewrite_module libexec/apache2/mod_rewrite.so
and deleting the leading #
More info: http://httpd.apache.org/docs/current/mod/mod_rewrite.html

Set the location of the tempdir

It is probarly pretty simple, but i cant find an solution.
How can i set the temp dir for file uploads.
What i want is change the location to www.mydomain.com/temporary
what i have tryd in .htaccess
php_value upload_tmp_dir "/home/mydomain.com/public_html/temporary/"
and without the last slash.
php_value upload_tmp_dir "/home/mydomain.com/public_html/temporary"
Does some one know if it is done by .htaccess and how?
According to the PHP manual, upload_tmp_dir can be changed only in php.in, not on a per-directory basis:
upload_tmp_dir NULL PHP_INI_SYSTEM
You'd have to have root access to the server to change that.

Resources