Forums / Setting Up Categories, Products, Attributes / redirect not working and host says its not their problem

redirect not working and host says its not their problem

Started by mhulak on 7 May 2012, 12:03 PM · Views: 5,940

Results 1 to 20 of 41
7 May 2012, 12:03 PM
#1
mhulak avatar

mhulak

New Zenner

Join Date:
Feb 2012
Posts:
78
Plugin Contributions:
0

redirect not working and host says its not their problem

webpage
https://www.michaelhulak.com

username- [email protected]
password- Password1

make an order for a free wallpaper
redirect is created when attempted to download

when downloading, error appears

HTTP/1.0 403 Forbidden
Date: Mon, 07 May 2012 06:42:04 GMT
Server: Apache
Content-Length: 371
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>403 Forbidden</title> </head><body> <h1>Forbidden</h1> <p>You don't have permission to access /pub/.cybmksklnmtsmhvrop/2009_04-25_IMG_7615_ED.jpg on this server.</p> <p>Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.</p> </body></html>
7 May 2012, 12:22 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: redirect not working and host says its not their problem

You'll need to edit the /pub/.htaccess file to include the .jpg file extension in the list of allowable files:

#
# @copyright Copyright 2003-2011 Zen Cart Development Team
# @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
# @version $Id: .htaccess 18695 2011-05-04 05:24:19Z drbyte $
#

## the following line is needed to allow Download-By-Redirect to work
  Options +FollowSymLinks

#
# This is used with Apache WebServers
#
# The following blocks direct HTTP requests to all filetypes in this directory recursively, except certain approved exceptions
# It also prevents the ability of any scripts to run. No type of script, be it PHP, PERL or whatever, can normally be executed if ExecCGI is disabled.
# Will also prevent people from seeing what is in the dir. and any sub-directories
#
# For this to work, you must include either 'All' or at least: 'Limit' and 'Indexes' parameters to the AllowOverride configuration in your apache/conf/httpd.conf file.
# Additionally, if you want the added protection offered by the OPTIONS directive below, you'll need to add 'Options' to the AllowOverride list, if 'All' is not specified. 
# Example:
#<Directory "/usr/local/apache/htdocs">
#  AllowOverride Limit Options Indexes
#</Directory>
###############################

# deny *everything*
<FilesMatch ".*">
  Order Allow,Deny
  Deny from all
</FilesMatch>

# but now allow just *certain* necessary files:
<FilesMatch ".*\.(zip|ZIP|gzip|pdf|PDF|mp3|MP3|swf|SWF|wma|WMA|wmv|WMV|wav|epub|jpg)$">
  Order Allow,Deny
  Allow from all
</FilesMatch>

<IfModule mod_headers.c>
  <FilesMatch ".*\.(zip|ZIP|gzip|pdf|PDF|mp3|MP3|swf|SWF|wma|WMA|wmv|WMV|wav|epub|jpg)$">
    # tell all downloads to automatically be treated as "save as" instead of launching in an application directly
    # ALERT: ForceType requires Apache2 or later. If using older version of Apache, it will need mod_mime installed. Or just comment out the ForceType line below
    # (to disable, just comment the next 2 lines by adding a '#' at the beginning of each):
    ForceType application/octet-stream
    Header set Content-Disposition attachment
  </FilesMatch>
</IfModule>

IndexIgnore */*


## NOTE: If you want even greater security to prevent hackers from running scripts in this folder, uncomment the following line (if your hosting company will allow you to use OPTIONS):
# OPTIONS -Indexes -ExecCGI
9 May 2012, 12:18 AM
#3
mhulak avatar

mhulak

New Zenner

Join Date:
Feb 2012
Posts:
78
Plugin Contributions:
0

Re: redirect not working and host says its not their problem

my page https://www.michaelhulak.com allows downloads and it uses redirects. the redirect is created and was working fine until recently. the redirect link isn't working. my server says it is because the link is not pointing to the proper location. here is what they explain the problem is.

*It seems that the path in your script is set to '/home/www/michaelhulak/download/wallpaper/2009_04_25_IMG_7615_ED.jpg' instead '../../download/wallpaper/2009_04_25_IMG_7615_ED.jpg'. That's why everytime when you are trying to load the link to the image you see this 403 error. You will need to set the path correctly in your script and this should resolve your problem. *

I recently had a problem with the page not loading properly and I found the problem.
the configuration file pointed root as
'/srv/disk1/817519/www/michaelhulak/');
I changed it to the following the fix the problem. Now the page loads, but the downloads don't.
'/home/www/michaelhulak/');

how can i get the download redirects to work again?

9 May 2012, 12:52 AM
#4
mhulak avatar

mhulak

New Zenner

Join Date:
Feb 2012
Posts:
78
Plugin Contributions:
0

Re: redirect not working and host says its not their problem

when following the redirect using ftp, i get the following

Status: Starting download of /michaelhulak/pub/.sgsgcffcfhtbxmdkf-1336524540/2012_04-06_IMG_1587_ED.jpg
Command: CWD /michaelhulak/pub/.sgsgcffcfhtbxmdkf-1336524540
Response: 250 CWD command successful
Command: PWD
Response: 257 "/michaelhulak/pub/.sgsgcffcfhtbxmdkf-1336524540" is the current directory
Command: TYPE I
Response: 200 Type set to I
Command: PASV
Response: 227 Entering Passive Mode (82,197,130,139,192,240).
Command: RETR 2012_04-06_IMG_1587_ED.jpg
Response: 550 2012_04-06_IMG_1587_ED.jpg: No such file or directory
Error: Critical file transfer error

9 May 2012, 1:01 AM
#5
mhulak avatar

mhulak

New Zenner

Join Date:
Feb 2012
Posts:
78
Plugin Contributions:
0

Re: redirect not working and host says its not their problem

checking the link shows the following

/home/www/michaelhulak/pub/.gytdbjkrgoiznhpyx-1336524740/2012_04-18_IMG_2083.zip -> /home/www/michaelhulak/download/Flower_Macros/2012 04-18 IMG_2083.zip

and the path of the actual file is correct and it is downloadable by going directly

https://www.michaelhulak.com/download/Flower_Macros/2012 04-18 IMG_2083.zip

9 May 2012, 2:04 AM
#6
mhulak avatar

mhulak

New Zenner

Join Date:
Feb 2012
Posts:
78
Plugin Contributions:
0

Re: redirect not working and host says its not their problem

my server would like to help resolve the issue and ask the following

*Hello Michael,

Thank you for contacting us.

Would you please provide us with information where we can find your configuration file (for your download) so we can investigate your problem and help you to resolve it.
*

i advised them i think it is \includes\modules\pages\redirect\header_php.php is this correct?

9 May 2012, 6:37 AM
#7
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: redirect not working and host says its not their problem

MHulak:

checking the link shows the following

/home/www/michaelhulak/pub/.gytdbjkrgoiznhpyx-1336524740/2012_04-18_IMG_2083.zip -> /home/www/michaelhulak/download/Flower_Macros/2012 04-18 IMG_2083.zip

and the path of the actual file is correct and it is downloadable by going directly

www.michaelhulak.com/download/Flower_Macros/2012 04-18 IMG_2083.zip

Download files must NOT contain any space characters. Replace them with underscores.

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

9 May 2012, 6:45 AM
#8
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: redirect not working and host says its not their problem

MHulak:

when following the redirect using ftp,

I'm not entirely sure what you mean by this. FTP doesn't know anything about HTTP redirects. In fact FTP doesn't have any relationship or connection with the webserver (http) at all. They are entirely different servers with entirely different commands, and entirely different access restrictions.

By default, they don't even have the same 'root' folder. FTP's entry point is generally one level up from the webserver (for admin logins), and in a completely different 'restricted' folder for others.

I'm not sure if knowing this is going to help you in any way, but I know it sure can't hurt :)

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

11 May 2012, 3:52 AM
#9
mhulak avatar

mhulak

New Zenner

Join Date:
Feb 2012
Posts:
78
Plugin Contributions:
0

Re: redirect not working and host says its not their problem

the spaces dont make a difference.

it was working before with those spaces as well
anyways, i have Filename: wallpaper/2009_04_25_IMG_7615_ED.jpg as a test

this one still has the issue

Forbidden

You don't have permission to access /pub/.qxkznngcnmsyluvsbinl-1336708213/2009_04_25_IMG_7615_ED.jpg on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

11 May 2012, 5:30 AM
#10
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: redirect not working and host says its not their problem

No matter how I respond to this. I'm sure you will somehow manage to take offence, although none is intended.

MHulak:

the spaces dont make a difference.

You are wrong. Spaces DO make a difference.

MHulak:

it was working before with those spaces as well

I'm not going to argue with you, because if it somehow did work, it shouldn't have.

I will point you to a couple of references that I beleive you will get some great benefit from though.
Firstly, from the ZenCart FAQ file:

https://www.zen-cart.com/content.php?113-how-do-i-make-products-downloadable which states
"Download filenames should not use special characters, spaces, etc"

Next I will refer you to RFC 1738: (The stuff that the 'internet' is 'built' upon), which defines what the 'special characters' are, and how they should be dealt with.
You may or may not recognise the name of the author, but if you wish to have an arguement about this I suggest you take it up with him :)

--- extract from RFC 1738 -----
Network Working Group T. Berners-Lee Request for Comments: 1738 CERN

URLs are written only with the graphic printable characters of the US-ASCII coded character set. The octets 80-FF hexadecimal are not used in US-ASCII,** and the octets 00-1F and 7F hexadecimal represent control characters; these must be encoded.** Unsafe: Characters can be unsafe for a number of reasons. The space character is unsafe because significant spaces may disappear and insignificant spaces may be introduced when URLs are transcribed or typeset or subjected to the treatment of word-processing programs. The characters "<" and ">" are unsafe because they are used as the delimiters around URLs in free text; the quote mark (""") is used to delimit URLs in some systems. The character "#" is unsafe and should always be encoded because it is used in World Wide Web and in other systems to delimit a URL from a fragment/anchor identifier that might follow it. The character "%" is unsafe because it is used for encodings of other characters. Other characters are unsafe because gateways and other transport agents are known to sometimes modify such characters. These characters are "{", "}", "|", "", "^", "~", "[", "]", and "`". All unsafe characters must always be encoded within a URL. For example, the character "#" must be encoded within URLs even in systems that do not normally deal with fragment or anchor identifiers, so that if the URL is copied into another system that does use them, it will not be necessary to change the URL encoding.

MHulak:

anyways, i have Filename: /wallpaper/2009_04_25_IMG_7615_ED.jpg as a test
this one still has the issue

I'm not trying to be difficult, but did you REALLY enter "/wallpaper/" as a
part of the filename ? Or was this simply a bad example.

As well as the space characters being illegal, the filename entered for
downloads should not contain a file path, as this would also
cause an error. In other words, you could have two different problems, either one of which will
produce the same error message.

Do you have ANY downloads that DO work? (I've tried several of your freebies, all give the same error).

When I went to test your downloads, I did so assuming that only "this one still has the issue".
I didn't expect to find they all have an issue.

I'm sorry if I appear to be pedantic, but computers are far more pedantic than I could ever be, and we
both tend to take whatever people type on their keyboard literally. As such, I tend to make the
same 'mistakes' as a computer will <g>. The difference is, unlike a computer, instead of simply producing an
error message I try to figure out what was actually meant. To do this I often need to ask some
pretty 'stupid' questions.

Anyway, before going further could I please ask you to create just one download item without spaces,
and without a possible "/wallpaper/" as a part of the filename. Whether it has worked ok with these before
or not is of no consequence. I'm not asking/expecting you to update all of them, just one.
The idea is to start out with things that we know will work, rather than what could work,
or what has worked in the past. If you still get permissions problems we can investigate further, but
without this groundwork we could just be going around and around in circles.

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

12 May 2012, 10:52 AM
#11
mhulak avatar

mhulak

New Zenner

Join Date:
Feb 2012
Posts:
78
Plugin Contributions:
0

Re: redirect not working and host says its not their problem

i added jpg to the htaccess file and still no go
<FilesMatch ".*.(zip|ZIP|gzip|pdf|PDF|mp3|MP3|swf|SWF|wma|WMA|wmv|WMV|wav|epub|jpg|JPG)$">

i removed the spaces to all the free wallpaper files and created a zip file for each as well. there is now an option to download zip or the original as a jpg. the files are in the download folder without a subdirectory. ie (root/downloads/XXXXX.zip and root/downloads/XXXXX.jpg) issue still happens.

as a test, i renamed pub/htaccess to htaccess.old and tried and still problem. i put the htacess back in place

not sure where to go to get these to work again

12 May 2012, 11:25 AM
#12
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: redirect not working and host says its not their problem

The userid and password you gave in your first post don't work ...

Good job removing the spaces in the filenames, those always mess things up. Did you did remember to change the filenames associated with the products in your database, too?

When you say that the files are in root/downloads, are your store's other files stored in root (e.g. is your configure.php file stored as root/includes/configure.php)?

12 May 2012, 12:14 PM
#13
mhulak avatar

mhulak

New Zenner

Join Date:
Feb 2012
Posts:
78
Plugin Contributions:
0

Re: redirect not working and host says its not their problem

lat9:

The userid and password you gave in your first post don't work ...

Good job removing the spaces in the filenames, those always mess things up. Did you did remember to change the filenames associated with the products in your database, too?

When you say that the files are in root/downloads, are your store's other files stored in root (e.g. is your configure.php file stored as root/includes/configure.php)?

someone must have changed the password. it is again Password1

the attributes db also reflect the changes to the file and both the jpg and the zip have a green circle indicating they are found.

this is correct root/includes/configure.php

12 May 2012, 3:55 PM
#14
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: redirect not working and host says its not their problem

I guess I really did offend you huh?

Oh well. NMP

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

12 May 2012, 5:00 PM
#15
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: redirect not working and host says its not their problem

What are your settings in your admin's Configuration->Attribute Settings->Download by Redirect and Download by streaming fields?

12 May 2012, 6:54 PM
#16
mhulak avatar

mhulak

New Zenner

Join Date:
Feb 2012
Posts:
78
Plugin Contributions:
0

Re: redirect not working and host says its not their problem

RodG:

I guess I really did offend you huh?

Oh well. NMP

Cheers
Rod

nope, I just forgot I already posted this issue. I am not offended, I am here to learn and get this working with support of people who know more.

12 May 2012, 7:00 PM
#17
mhulak avatar

mhulak

New Zenner

Join Date:
Feb 2012
Posts:
78
Plugin Contributions:
0

Re: redirect not working and host says its not their problem

lat9:

What are your settings in your admin's Configuration->Attribute Settings->Download by Redirect and Download by streaming fields?

here is the complete page

Enable Downloads true
Download by Redirect true Info
Download by streaming false Info
Download Expiration (Number of Days) 7 Info
Number of Downloads Allowed - Per Product 5 Info
Downloads Controller Update Status Value 4 Info
Downloads Controller Order Status Value >= lower value 2 Info
Downloads Controller Order Status Value <= upper value 4 Info
Enable Price Factor true Info
Enable Qty Price Discount true Info
Enable Attribute Images true Info
Enable Text Pricing by word or letter true Info
Text Pricing - Spaces are Free 1 Info
Read Only option type - Ignore for Add to Cart 1

im going to test without redirect and see if that works. without redirect, it works fine. pub directory permissions is 777 with recursive to sub directories too

12 May 2012, 7:21 PM
#18
mhulak avatar

mhulak

New Zenner

Join Date:
Feb 2012
Posts:
78
Plugin Contributions:
0

Re: redirect not working and host says its not their problem

my server is saying the link syntax is like
2009_04_25_IMG_7615_ED.jpg -> /home/www/michaelhulak/download/2009_04_25_IMG_7615_ED.jpg

and if the link syntax was like
2009_04_25_IMG_7615_ED.jpg -> ../../download/2009_04_25_IMG_7615_ED.jpg
it will work

the file that makes the redirect is /includes/modules/pages/download/header_php.php
however, i am not sure how to test this suggestion

12 May 2012, 8:05 PM
#19
mhulak avatar

mhulak

New Zenner

Join Date:
Feb 2012
Posts:
78
Plugin Contributions:
0

Re: redirect not working and host says its not their problem

I was looking into where the redirect was created so I entered some ambiguous text in
/includes/modules/pages/download/header_php.php

the download link says it is an MP3 format for the ZIP file for some reason

and it is working now. I don't think this is how it should be left. I added AA to the path. removing everything in the path give a 404. Previously the value was just a slash /

// Redirect usually will work only on Unix/Linux hosts since Windows hosts can't do symlinking in PHP versions older than 5.3.0
if (DOWNLOAD_BY_REDIRECT == 'true') {
zen_unlink_temp_dir(DIR_FS_DOWNLOAD_PUBLIC);
$tempdir = zen_random_name() . '-' . time();;
umask(0000);
mkdir(DIR_FS_DOWNLOAD_PUBLIC . $tempdir, 0777);
$download_link = str_replace(array('/','\'),'_',$browser_filename);
$link_create_status = @symlink(DIR_FS_DOWNLOAD . $origin_filename, DIR_FS_DOWNLOAD_PUBLIC . $tempdir . 'AA/' . $download_link);

if ($link_create_status==true) {
$zco_notifier->notify('NOTIFY_DOWNLOAD_VIA_SYMLINK___BEGINS', $download_link, $origin_filename, $tempdir);
header("HTTP/1.1 303 See Other");
zen_redirect(DIR_WS_DOWNLOAD_PUBLIC . $tempdir . '/' . $download_link, 303);
}
}

12 May 2012, 8:33 PM
#20
mhulak avatar

mhulak

New Zenner

Join Date:
Feb 2012
Posts:
78
Plugin Contributions:
0

Re: redirect not working and host says its not their problem

i changed the file location of the following just to see if something about the structure was the problem. as you can see, the file location is in a sub directory and works

Orange Daffodil 0.50 MB wallpaper/2012 03-04 IMG_0682 ED.jpg 05/19/2012 5

the pub directory makes a folder during the download however there is nothing inside the folder. does this mean it is defaulting to direct instead of redirecting?