I want to disable everything in directory sessions/ except of the file .htaccess that disable indexes of the directory, I have this in my .gitignore:
sessions/*
but this also ignore .htaccess file that inside sessions.
you can add exceptions with exclamation mark:
sessions/*
!sessions/.htaccess
Related
Is there any need for .htaccess files in directories higher than that where index.html is placed?
I found such a file one level higher after a FileZilla accident (my fault; not Filezilla's) and suspect it should be deleted.
The .htaccess file has an effect on the directory it's in and all the descendent directories. You would need another .htaccess in a sub-folder if it was altering rules or adding new ones to what was inherited from its parent directory.
To expand on this based on more info from below: If the .htaccess files are in directories above your hosting dir, they will have an effect. However you should not amend or delete files on shared servers that you don't have direct authorization to. Check with your host or sysadmin - maybe those files need to be there, or perhaps they can be tidied up. In any case you can override .htaccess rules with a .htaccess file in the subdirectory.
This occurs in Sublime Text 2 and Wordpad, Notepad. I have been fighting to remove index.php from my URLs and I wondered if this might be the problem, I'm new. Thanks.
Yes, it will affect your codeigniter setup - your mod_rewrite rules won't be picked up unless the file is called .htaccess, and so the index.php won't be removed like you want it to.
I would fix this by going into a terminal/command prompt, go to the directory where the .htaccess.htaccess file is and renaming the file there.
If you are using windows, you do this with the command (once you are in the correct directory)
rename .htaccess.htaccess .htaccess
I have a vps with a number of sites. One of them is having an issue where the .htaccess file is be deleted every 24hrs. I do not think it is an issue to do with the host as there are a good nuimber of similar sites with .htaccess on the same VPS.
Taking a look around I noticed a .gitignore file, unique to this site. To be honest I am not 100% sure what it does. Opening it I saw:
# ignore any files beginning with .
\.*
# except do not ignore .gitignore
!.gitignore
Could this be affecting my .htaccess file?
Turns out yes, .gitignore was responsible. I added:
# except do not ignore .gitignore
!.gitignore
!.htaccess
I have my website hosted on 1and1 servers and I want to adjust some settings in a php.ini file. I can create the file and it is being interpreted correctly but only for the immediate directory not for any subdirectories. I would like to not have to copy the php.ini file into every single subdirectory. The only way I have seen to do this from googling is to add the following to the .htaccess file
suPHP_ConfigPath /path/to/htdocs/php.ini
I have an .htaccess file and the different directives I have in there are being interpreted correctly but when I add that line it causes a 500 Internal Server error.
Can anyone suggest what I can do so that the php.ini settings are used in all the subdirectories without having to duplicate the php.ini file into all the subdirectories?
You could create soft links in each folder to your main php.ini. 1and1 disallows many directives in their .htaccess files. 1and1's support site has more information.
The suPHP is evaluated in a .htaccess PerDir context. If you want to have different ini files for different directories then you need to use a separate .htaccess in each relevant directory. By default Apache will use the lowest .htaccess on the request URI's path that it can find. Alternatively if you have a systematic naming convention for the filenames, then you ban place the different suPHP directives in different directives.
I have an .htaccess file in the folder called folder and another file, called form.html in the same folder
When I try to reach the folder (by entering http://blablabla/folder/), it does block the access and I am getting an error 403 but when I enter the exact URL of the file http://blablabla/folder/form.html anf hit enter, I can access the file as easily as if I haven't put any .htaccess file.
Am I doing something wrong?
Am I missing something, should I use something like or
Sorry if the question is really basic...
.htaccess is a container for directives for your apache web server that apply to that directory and below only. What directives have you got in your .htaccess file?
The behaviour you outline above is how apache should behave with no .htaccess folder.
What is it that you are wanting to happen?