Zen Cart Logo
Forums / General Questions / .htaccess file causes problem

.htaccess file causes problem

Views: 1,172

Results 1 to 4 of 4
16 Mar 2011, 12:47 AM
#1
jasonhoward64 avatar

jasonhoward64

New Zenner

Join Date:
Jun 2009
Location:
Saskatchewan, CDN
Posts:
68
Plugin Contributions:
0

.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!!

16 Mar 2011, 1:42 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: .htaccess file causes problem

jasonhoward64:

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=73NOTE: If you're using the latest version of Zen Cart, then these .htaccess protections are already in place.
jasonhoward64:

After uploading the .htaccess file into the /images folder, it wasn’t visible in either my FTP programThat'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.)> 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?> 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.
jasonhoward64:

Are there any php over rides in the above code?
No.

16 Mar 2011, 6:15 AM
#3
jasonhoward64 avatar

jasonhoward64

New Zenner

Join Date:
Jun 2009
Location:
Saskatchewan, CDN
Posts:
68
Plugin Contributions:
0

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!

16 Mar 2011, 7:15 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: .htaccess file causes problem

Thanks!
Glad you got it sorted out!