Notifications
Clear all

Link to PDF wrong

4 Posts
2 Users
0 Reactions
3,590 Views
Posts: 16
Customer
Topic starter
(@dlinstedt)
Member
Joined: 6 years ago

To whom it may concern:  A few weeks ago I got a message for a PDF attachment that my forum has.  I just looked into the problem, and the issue is:

Advanced Attachments is interpreting the "shortcode" in the wpForo Post as follows:

https://datavaultalliance.com/datavaultalliance.com/wp-content/uploads/wpforo/attachments/1/13-DVModelingSpecs202.pdf

It's adding the domain TWICE to the URL.  This is a problem for me.

Do you think it's the .htaccess code?  (posted below)

OR is it just the Advanced Attachments code not working properly?

# This file was updated by Duplicator Pro on 2019-02-07 03:34:01.
# See htaccess.orig for the .htaccess original file.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# Prevent Direct Access Rewrite Rules
RewriteRule ^pda/([a-zA-Z0-9-_.]+)$ index.php?pda_v3_pf=$1&pdav3_rexypo=ymerexy [L]
RewriteCond %{HTTP_USER_AGENT} !facebookexternalhit/[0-9]
RewriteCond %{HTTP_USER_AGENT} !Twitterbot/[0-9]
RewriteCond %{HTTP_USER_AGENT} !Googlebot/[0-9]
RewriteRule ^wp-content/uploads(/_pda/.*\.\w+)$ index.php?pda_v3_pf=$1 [QSA,L]
# Prevent Direct Access Rewrite Rules End

# IP Block Rewrite Rules for Folder Protection
RewriteRule ^wp-content/uploads(/(wpforo)/.*\.\w+)$ index.php?pda_v3_pf=$1 [QSA,L]
# IP Block Rewrite Rules for Folder Protection End

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
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 WAF

3 Replies
Astghik
Posts: 6153
Admin
(@astgh)
Illustrious Member
Joined: 7 years ago

Hi @dlinstedt,

OR is it just the Advanced Attachments code not working properly?

We've check this and everything is working fine on all test websites.  You can check it here to make sure: https://addons.wpforo.com/community/wpforo-advanced-attachments/

Do you think it's the .htaccess code?  (posted below)

Yes, I think something is wrong with your website configurations but I could not say exactly what.  

Reply
Posts: 16
Customer
Topic starter
(@dlinstedt)
Member
Joined: 6 years ago

Agreed!  You guys rock, your code is clean and solid.  Thank you for such an incredibly wonderful product.  I really appreciate it, as forum software & attachments go - it's not easy at all to make things work properly.

I am researching this further, and I believe? it may have to do with either Elementor or Astra themes, which probably "prefixes" HREF links that it finds are "headless"  (without https or https prefixes).

Turns out, as soon as I added the "https:" prefix back to the $fileurl in wpForoAttachmentsTools.php (inserted a new line 104 just to test), that the problem disappeared.  I believe, it has to do with Elementor automatically "completing href" to fully qualified that don't have a header prefix on them.

So my question is:

1) Can you "add a settings switch in the admin control panel for wpForoAdvanced Attachments" that says: "force prepend with https/http (server prefix)"??

2) let me turn it on / off in the admin panel?

I think, this will fix it for themes like Elementor that "go above and beyond" to make sure no HREF URLS are left hanging.

Reply
Posts: 16
Customer
Topic starter
(@dlinstedt)
Member
Joined: 6 years ago

I ran another test (just now), and it in fact IS Elementor Theme - "coming to the rescue" and pre-pending all HREF items that are "left without prefixes"...  Problem is: it adds in the domain of the site as well.

I suppose your other option is to: "remove the domain" from the $fileurl reference as well.

By the way, the "fix" has to be made in both do_shortcodes and do_default_attachs

Thanks!

Reply
Share:
Scroll to top