• I’m trying to create a button or a link on my WordPress site for a .exe file. I have the following in the text section of the page:

    <a href="/home2/projecttoday/public_html/SELMS-setup.exe"> Click Here</a>

    When I click on the link, I get “404 Page Not Found”.

    When I display File Manager for the site there is a file called SELMS-setup.exe in /home2/projecttoday/public_html. So what am I doing wrong? How can I debug this?

Viewing 15 replies - 16 through 30 (of 41 total)
  • You create a new directory downloads in your public root.
    Then put a file test.txt in this directory and simply try to open the address yourdomain.com/downloads/test.txt in your browser. If all goes fine, then you can put other files in the same directory and refer to them via the full absolute URL.

    … Oh. And make sure that you don’t have any page with a conflicting address (i.e. “downloads”)!

    Thread Starter projecttoday

    (@projecttoday)

    I do have a page called “download” without the s. So I guess that shouldn’t be a problem.

    I change .htaccess to:

    # BEGIN exclude directories /download/ and /downloads/ from rewrites
    RewriteEngine On
    RewriteRule ^(downloads|download)($|/) - [L]
    # END exclude directories /download/ and /downloads/ from rewrites
    # 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

    still not working.

    Thread Starter projecttoday

    (@projecttoday)

    You create a new directory downloads in your public root.

    Is public root “public_html”?

    1. Then please delete the |download in that first rewriterule, so that WordPress will get the call for whateveryourdomain.com/download.
    2. If you in ftp see a directory called public_html, then this is most probably the place where your public root is located. (And I guess this is where you’ve got your WP installed, too.

    3. You may try to delete the second occurence of “RewriteEngine On”, which is located inside the WP standard rules.

    Thread Starter projecttoday

    (@projecttoday)

    Still no joy. I tried:

    <a href="httр://www.cronapacific.com/downloads/testdoc.txt"> Click Here</a>

    cronapacific is the website and there is a file called testdoc.txt in /home2/projecttoday/downloads.

    Thread Starter projecttoday

    (@projecttoday)

    I’m sorry I’m not following your instructions. What do I need to do to this?

    # BEGIN exclude directories /download/ and /downloads/ from rewrites
    RewriteEngine On
    RewriteRule ^(downloads|download)($|/) - [L]
    # END exclude directories /download/ and /downloads/ from rewrites
    # 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

    Works for me. Try to clear your browser cache.

    Change to:

    # BEGIN exclude directories /downloads/ from rewrites (took away /download/ below)
    RewriteEngine On
    RewriteRule ^(downloads)($|/) - [L]
    # END exclude directories /download/ and /downloads/ from rewrites
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    #RewriteEngine On ---Commented out this line
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    Thread Starter projecttoday

    (@projecttoday)

    No joy. I changed .htaccess to the above and I tried it in Internet Explorer which I never use so it’s cache should be empty and I still get the same result.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    @projecttoday, Please do not duplicate your thread again. Half the conversation in this thread was already discussed in your last.

    Thread Starter projecttoday

    (@projecttoday)

    I’m still looking for a solution.

    Thread Starter projecttoday

    (@projecttoday)

    Can anyone help me with this?

    Moderator bcworkz

    (@bcworkz)

    Tor-Bj?rn said (emphasis mine):
    “So you only have the standard WP content in this file, which “hi-jacks” all requests to your domain and points them to the main index.php if no direct match is found.”

    Absolutely correct. However, the file we are trying to download would be a direct match, so there is really no point in excluding downloads from redirects. Thus, for the time being, please restore your .htaccess file to the way it was originally. You can restore Tor-Bj?rn’s code later if you want.

    Copy your testdoc.txt file to the WordPress /wp-content/uploads/ folder. This is where there are also year sub-folders like 2016, 2017, etc. Deactivate your coming-soon plugin. While it shouldn’t be interfering, I’d like to eliminate all possible undue influence. Please leave it deactivated for a while so others can test file access in order to eliminate any client side issues.

    If it helps any, you could create a similar Under Construction page using the usual WP interface. In the WP admin area, go to Settings > Reading, and set the Front page displays option to A static page and pick your under construction page for Front page:. I believe you can leave the Posts Page: unselected. Or create another page with just a title (no content required) and choose that as the posts page. Click Save changes.

    Add this link somewhere, perhaps you new Under Construction page: <a href="httр://www.cronapacific.com/wp-content/uploads/testdoc.txt">Test Doc (.txt)</a> Try the link, it should work.

    For further exploration of your options, copy the text file to the WP installation root (the folder with wp-config.php). I was able to access license.txt that is already there, so there should be no reason your own text file would not work as well.

    Despite the non sequitur of downloads in an uploads folder, either of these folders should be viable locations for users to be able to download a file. If these tests do not work for some reason (and you’ve verified the file permissions are correct), I would expect something like mod_security is active on the server and preventing proper access. In that case, lets return to the downloads folder scheme. Contact your host and complain you cannot access files in /downloads/. They’ll adjust the security settings.

    Once you’ve identified a viable location for simple text files, you can try the .exe file. I would not be surprised if it still does not work due to other security measures. It’s probably a good idea to wrap any .exe download in a file compression container like .zip or .tar.gz. Not only is less security applied, the file size is usually reduced.

    Thread Starter projecttoday

    (@projecttoday)

    Thank you. I restored htaccess and copied testdoc.txt to wp-content/uploads. I’m confused about what you mean by WP interface. Is that the dashboard?

    My existing “Under Contruction” appears to be gone.

Viewing 15 replies - 16 through 30 (of 41 total)
  • The topic ‘Download button of .exe file’ is closed to new replies.