Links to files in s2member-files folder redirecting to signup page

Hi,
We’ve been running S2Member Pro on our site for many years now and have had very few issues. Recently, a user reported that they were getting redirected to the member signup page when they tried to download a file in the S2Member-Files folder even though they had an active membership. I checked, and all account levels, including admins, are now getting redirected for all files in that folder.

I double-checked to make sure that our Basic Download Restriction options were still correct in Download Options. I then looked at the .htaccess file in the S2Member-Files folder and it looked correct/unchanged as far as I could tell.

Occasionally a file from the folder will give an access denied message (but usually it’s the redirect to the signup page). I confirmed that our permissions were 755 on the folders and 644 on the files.

Any idea what might be causing this? It seems to be a fairly recent issue, so I’m guessing something might have been changed in an update or something. I can get you access to our site if needed for troubleshooting.

Thanks so much for your help!
Matt L.

Okay, I’m starting to narrow this down. There seem to be two separate problems here:

1.) Older links that have http:// instead of https:// redirect to the membership signup page. This was mentioned in another post in this forum, and I’m going through and fixing these.

2.) Any link that has a space in the filename is no longer working. This seems to be the main issue. The organization that owns the site has added several hundred items in their s2member-files directory over the years, and a number of them have spaces, and these files have links to them on various pages. The links seem to be converting the spaces to HTML notation correctly when you click on them. E.g.:

https://oursite.com/wp-content/plugins/s2member-files/some file name.pdf

Has this URL in the address bar when you click on it:

https://oursite.com/wp-content/plugins/s2member-files/some%20file%20name.pdf

Any file with a space in it is now creating a 403 Forbidden error when you click the link to it. I’m guessing this is something that might need to be changed in the s2member-file directory’s .htaccess file?

Thanks for any help or ideas. I can go through and change all these manually if needed, but it would be quite tedious given the number of member-only files (and links to them) they’ve added over the years.

Don’t link directly, use the obfuscated link.

Yeah, things like that can affect the login session. See: https://s2member.com/kb-article/how-to-avoid-login-issues/

https://oursite.com/wp-content/plugins/s2member-files/some%20file%20name.pdf

As Felix said, don’t link directly to the file, that directory is protected and won’t let direct access to the files. Do it via s2Member as mentioned in the options page: WP Admin > s2Member > Download Options

https://oursite.com/?s2member_file_download=some%20file%20name.pdf

You can use the s2File shortcode if the link is in a place where shortcodes get parsed:
[s2File download="some file name.pdf" /]

:slight_smile:

Hi,
Thanks for the replies! And I apologize for replying late myself. For some reason, I missed Felix’s early response back in November. I think it was around one of our national holidays when we had a lot of family visiting.

I’ve fixed some of these links manually, but have run into two issues:

1.) They created various subfolders inside of the s2member-files folder. I can link to these directly (not recommended, I know) and they work if the file is only one subfolder down from the main s2member-files folder, but they don’t work if it’s deeper than that. I can’t figure out how to link to a file inside a subfolder with the indirect link. E.g.,. should it be:

https://oursite.com/?s2member_file_download=/subfolder1/subfolder2/some%20file%20name.pdf

Or are subfolders not possible with that type of link? I’m looking at hundreds (maybe a few thousand?) of these files, so I’m hoping there’s some way to point to their location within the subfolders.

Thanks again for your help!

Matt

I use subfolders (3 levels) without problems.
domain.com/?s2member_file_download=odbl/nonunicode/md5_hashes/mtbcyprus.exe.txt
for example works. If it doesn’t maybe you have some problems with your nginx rules?
“%” could be affected by some nginx rules further down. I do not use special characters.

Thanks for that! Looks like I was putting in a leading slash that wasn’t needed.

I think I finally figured out our core problem. The older links all had our site name without a “www” prefix. When the site changed hosting providers, the new provider set the default domain to have the “www” prefix and redirected non-www requests to www.

Any s2member file links that don’t already have the “www” prefix redirect to our membership page. I’m guessing this is a login cookie issue, similar to the http:// instead of https:// issue. Anyway, I can go through and replace the links and that should fix it.

Thanks again to everyone for the help and advice!

1 Like

Right. See: https://s2member.com/kb-article/how-to-avoid-login-issues/#toc-8dbb2b52

Anyway, I can go through and replace the links and that should fix it.
Thanks again to everyone for the help and advice!

:slight_smile: :+1: