.htaccess is being ignored in one subfolder - php

I have been looking around for hours now and can't seem to find a solution, so time to ask a question.
I got a .htaccess file that is being ignored in a specific subfolder. All other .htaccess files work as they should in their respective folders. I got no specific rules set up for the folder.
The .htaccess file contains Options -Indexes
The root folder is a Magento webshop and the folder in question is two subfolders down.
root/shop/colors/ (colors is the bugged one)
I got a exact copy of the folder structure and files but with different names and that .htaccess works.
root/test/colors/
So why is one .htaccess being ignored but not the rest?

The index.html in the bugged folder where cached and use a manifest file. When i cleared it with chrome://appcache-internals/ It started to work.
So why does appcache prevent .htaccess files?

Related

create rewrite rules only for one specific folder

I am using WP site. its working fine. but i have one issue that is i have created a folder that is myfolder. In this folder i have created index.php file and added some JS and CSS files. so now my site link like below.
http://www.domain.com/myfolder/index.php?ver=52
Now i am working for increase site speed task. I want to enable gzip for this folder. so i think htaccess is the fine for increase speed of site. So i want to create rules only for this folder. when i will add condition rules only work for this folder then i can enable gzip for this folder. I am new in htaccess. So please let me know how i add condition and rewrite rules from htaccess from site htaccess file only for this folder.

.htaccess to deny every direct acces request except allowing the request to a single folder

I am using codeigniter and have put the assets folder in the root of the application that contains a .htaccess file having the content
Deny from all
This is causing problems when I want to connect to the assets folder to get the stylesheets etc. So my question here is is there any way that I can allow the access just to that assets folder, that I have?
I have never used .htacces files so have a very basic knowlege of it. I did some research on my own as well but I wasn't able to find the solution.
In your assets directory add another .htaccess file with the following:
# /assets/.htaccess
Allow from all
And I am assuming in your root directory you have the following (which you will leave):
# /.htaccess
Deny from all
Update: Based on your comment, what you are looking to do is not really possible. The browser needs to have access to your CSS file in order to use it on your page.

htaccess redirect based on extension but on one domain only

I have just installed a CMS and all of my page name file extensions have now changed to .php instead of .html. I am told that editing the .htaccess is the best way to achieve this, however, in order to do that I have to change that in the root of my hosting account and I have multiple domains in my account (hostgator) and I only want the rule to apply to one domain specifically - not all domains. How do I achieve this?
.htaccess files are per-directory settings. You are correct that if you place one in your root directory it will affect all your domains, but the root directory is not the only place a .htaccess file is allowed -- you may put them in your domain-specific folder if you'd like that set of rules to only apply to that domain.
htaccess files affect the directory they are placed in and all sub-directories, that is an htaccess file located in your root directory (yoursite.com) would affect yoursite.com/content, yoursite.com/content/contents, etc. It is important to note that this can be prevented (if, for example, you did not want certain htaccess commands to affect a specific directory) by placing a new htaccess file within the directory you don't want affected with certain changes, and removing the specific command(s) from the new htaccess file that you do not want affecting this directory. In short, the nearest htaccess file to the current directory is treated as the htaccess file. If the nearest htaccess file is your global htaccess located in your root, then it affects every single directory in your entire site.
source

change security permission in a website

I have a website that is working properly.I dont know when I do "Domain-name.com/images" It shows me all the images in the images folder present at my site.I dont know why is this.may be this is due to the Directory permissions?But I want to ask know the actual reason behind it
Help will be appreciated.
Note:I am tagging Php and Html because these people might faced this thing while creating website.
This is because there is no index file in the folder, and Apache (assuming Apache) is set to do directory indexes.
Either create an empty index.html or add the following in either apache2.conf (or httpd.conf) or in a htaccess file:
Options -Indexes
You can restrict the folders using .htaccess.
Create .htaccess file in you website root folder and add the following code in it.
RewriteEngine on
RewriteCond $1 !^(css|js|images)
RewriteRule ^(.*)$ index.php/$1 [L]
This is a problem with the configuration of your web server which allows directory listing for your image folder. E.g. on Apache, the most common server software, you would switch it off in the httpd.conf with the directive Options -Indexes in a directory section.
To answer your question: yes. If it's a web accessible directory meaning it resides in the typical webroot folder such as public_html, www, etc and the permissions on the folder are open then anyone can see the contents.

How can I use a clean URL only in a subfolder of my website?

I have a web site http://www.mydomain.com
Here I have created a sub folder http://www.mydomain.com/products. I want to change all the page inside the product folder as clean URL. I know .htaccess should be inside product folder. If it's enabled, will it affect all the parent directories and files of my site
I mean http://www.mydomain.com/ here, will it affect the pages here also.
I have one more doubt about .htaccess file, is there a way I can enable mod_rewrite through any code code without directly editing httpd.conf file
Please help me
Thanks
i have one more doubt about .htaccess file, is there a way i can enable mod_rewrite through any code code without directly editing httpd.conf file
You place this line before any rewrite rules in your .htaccess file, which will switch on the rewrite engine - no httpd.conf change required.
RewriteEngine on
If it's enabled, will it affect all the parent directories and files of my site
The .htaccess file will only affect the folder it is in and any subfolder of that folder.

Categories