WordPress.org

Ready to get started?Download WordPress

Forums

PDF links 404 error when logged out (2 posts)

  1. redone975
    Member
    Posted 1 year ago #

    Hello,

    I'm currently stumped on an issue I'm experiencing on a site currently in development.

    When trying to access PDFs on the site, I'm receive a 404 error when I'm not logged in.
    However, when I log into the site, the PDF links work fine.

    Any insights into what might be causing this issue would be appreciated.

    htaccess file:

    AddHandler php-stable .php
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    
    # protect wp-config.php
    <files wp-config.php>
    order allow,deny
    deny from all
    </files>
    
    # protect htaccess
    <Files ~ "^.*\.([Hh][Tt][Aa])">
    order allow,deny
    deny from all
    satisfy all
    </Files>
    
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 2 days"
    ExpiresByType text/css A2592000
    ExpiresByType text/plain A2592000
    ExpiresByType image/jpg A2592000
    ExpiresByType image/jpeg A2592000
    ExpiresByType image/gif A2592000
    ExpiresByType image/png A2592000
    ExpiresByType image/x-icon A2592000
    ExpiresByType image/icon A2592000
    ExpiresByType application/x-ico A2592000
    ExpiresByType application/ico A2592000
    ExpiresByType text/javascript A2592000
    ExpiresByType application/javascript A2592000
    ExpiresByType application/x-javascript A2592000
    </IfModule>
    
    # compress text, HTML, JavaScript, CSS, and XML
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    
    # remove browser bugs
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    Header append Vary User-Agent
  2. redone975
    Member
    Posted 1 year ago #

    I just reverted the permalinks to the default setting and when trying to access a pdf, I noticed a "/" appended to the end of the file... Odd, right?

    http://websiteurl.com/wp-content/uploads/2013/02/File-name.pdf/

    I switched back to previously used permalink "Post Name" structure:
    http://websiteurl.com/%postname%/

Topic Closed

This topic has been closed to new replies.

About this Topic