.htaccess file causes problem
Hi everyone,
I’ve got a question regarding .htaccess files. I followed the following guidance on putting together a .htaccess file.
https://www.zen-cart.com/tutorials/index.php?article=73
It recommended that I use the following code:
#.htaccess to prevent unauthorized file access files
OPTIONS -Indexes -ExecCGI
IndexIgnore */*
### This part says to deny access to EVERYTHING. Afterwards, you'll allow access to JUST the permitted items. See next FilesMatch section.
<FilesMatch .*>
Order Deny,Allow
Deny from all
</FilesMatch>
### NOTE: Add only appropriate PERMITTED filetypes to this list, depending on which folder you're protecting:
<FilesMatch .*\.(js|css|jpg|gif|png|swf)>
Order Deny,Allow
Allow from all
</FilesMatch>
After uploading the .htaccess file into the /images folder, it wasn’t visible in either my FTP program or in the cPanel file browser, but it did have an effect. When you clicked a product, the product image was broken and didn’t appear. At first, I wasn’t sure what the cause of this could be, but I made a .htaccess file that contained nothing, uploaded it to the same folder and the problem was SOLVED!
I emailed my hosting company (Camelot-hosting) about .htaccess files. The service rep said, “Yes you can upload htaccess files ( make sure there are no php over rides in them )”
Are there any php over rides in the above code? Also, does anyone know why my product images didn't work when I used the above code in my .htaccess file?
Thanks!!
Re: .htaccess file causes problem
Quote:
Originally Posted by
jasonhoward64
NOTE: If you're using the latest version of Zen Cart, then these .htaccess protections are already in place.
Quote:
Originally Posted by
jasonhoward64
After uploading the .htaccess file into the /images folder, it wasn’t visible in either my FTP program
That's likely because most FTP programs are configured by default to hide files starting with a "." in the filename. (The "." means "hidden" in most operating systems.)
Quote:
Originally Posted by
jasonhoward64
When you clicked a product, the product image was broken and didn’t appear.
Maybe you put it in the wrong place? Maybe you put a typo in it?
Quote:
Originally Posted by
jasonhoward64
I made a .htaccess file that contained nothing, uploaded it to the same folder and the problem was SOLVED!
That would be the same as deleting the .htaccess file itself.
Quote:
Originally Posted by
jasonhoward64
Are there any php over rides in the above code?
No.
Re: .htaccess file causes problem
Thanks Dr. Byte.
I think I've got everything working. I'm not sure if you'll see this, but I just want to know that you've changed my life with Zen Cart. For that, I thank you!
Re: .htaccess file causes problem
Thanks!
Glad you got it sorted out!