Documents 404 when logged out
-
Hi,
I have been using FileAway on this website for some time but recently took it down to relaunch it as a multisite.
Since I have relaunched, navigating through the directories and selecting one of the listed documents results in a 404.
When I am logged in to WordPress and select the same file, it indicates there is no file.
Would you know the cause of this?
-
This topic was modified 7 years, 1 month ago by
tomgamwell.
The page I need help with: [log in to see the link]
-
This topic was modified 7 years, 1 month ago by
-
Shortcode please. Also, that page is password protected
Apologies.
Shortcode is as follows, running 3.9.9.0.1:
[fileaway type=”table” recursive =”on” directories=”on” manager=”on” role_override=”administrator” dirman_access=”administrator”]
Page password is: ResourceDorset
Many thanks.
Tom.
Hi Thom,
Did you happen to get anywhere with this issue?
I have since uninstalled FileAway, reinstalled and altered the source directory name and it does not seem to have helped. While the files are on the server in the correct place, it is still stating there is no file. It’s a strange one!
If you need anything else from me I am happy to provide it; just let me know.
Tom.
Sorry. I didn’t see your response from 6 days ago until now. Checking.
Your files are all in a parent directory called
resource. But when I navigate to https://ourdorset.nhs.uk/resource it redirects to https://ourdorset.nhs.uk/resources/.This leads me to believe that you have created a WordPress page that has the page slug “resource”. You can’t have a directory and a page slug with the same name. Hence the 404.
When clicking on a file to download, WordPress thinks you’re trying to go to a child page of the page “resource”.
That’s what I suspect anyway. Verify for me that you don’t have a page (published, private, or in the Trash) with a page slug of “resource”.
If you don’t, verify there’s no htaccess redirect in your ‘resource’ directory.
Your first subdirectory is
Branding and guidance.If you go to https://ourdorset.nhs.uk/resource/Branding%20and%20guidance/ you’ll see that WordPress thinks it’s trying to load a page, not a directory.
The issue isn’t with File Away.
OK – thanks Thom, I will check it out.
It didn’t occur to me as it was working fine before the change to multisite so perhaps as part of the redirect rules added to set up that it has affected it.
Thanks for the clarification.
I have no page with the slug ‘resource’, only ‘resources’. I have nothing pending or in the trash either so I assume it must be to do with the additional multisite rules added to .htaccess.
Yeah. Got to be the .htaccess then. Let me know if you get it figured out. For posterity.
I still don’t understand the issue. I have changed the name of the parent directory to ‘media’ – again, there is no duplicate of this slug and it still is trying to load a page rather than directory.
Now – I understand this isn’t a FileAway issue necessarily, I believe it works on multisite installs. Can you see an error in the edited .htaccess below that may lead to this issue? If not – I will ask WordPress. In this case, the multisite install is using subdirectories, rather than subdomains.
Thanks for your help.
# php — BEGIN cPanel-generated handler, do not edit
# NOTE this account’s php is controlled via FPM and the vhost, this is a place holder.
# Do not edit. This next line is to support the cPanel php wrapper (php_cli).
# AddType application/x-httpd-ea-php70 .php .phtml
# php — END cPanel-generated handler, do not edit
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ – [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress
# Wordfence WAF
<Files “.user.ini”>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
# END Wordfence WAFUnfortunately I’m not expert enough in htaccess vernacular to understand everything going on there. I might try ruling out the wordfence portion as the culprit first.
We know it isnt file away related because if you paste the link to one of those files directly into the url address bar, you get the 404 too. And we know the link is correct because file away found those files in that location.
So it’s definitely the htaccess.
Never encountered this issue on multi site before. Have plenty of multi site file away users.
I thought as much!
OK – I will try and figure it out, if I get to the bottom of it I will let you know.
Thanks for taking a look.
Hi Thom,
I seem to have made progress on this one, it was definitely a .htaccess and rewrite rule issue.
Adding an ! prior to the -f within the multisite rewrite rules allowed the site to find the directory at /resource/ once more. However, when you clicked through to a document it would then leave the directory and attempt to look up a page again (despite the .pdf).
It is the final line of the WordPress rule that was causing the issue as commenting it out allowed the documents to be downloaded but caused a 404 on ever page a part from the home page.
Adding a .htaccess to the document parent directory ‘resource’ which solely states ‘RewriteEngine Off’ seems to block this rewrite rule and allow the site to function.
Not a graceful fix by any means but it works for now while I look for something a bit neater!
Thank you for your time on this.
The topic ‘Documents 404 when logged out’ is closed to new replies.