admin管理员组文章数量:1410730
I want to first point out that I have tried to solutions listed in this post and in every case it either hasn't worked or hasn't been appropriate for what I'm trying to do. I have tried several different methods from several different sites and I'm unable to find anything that works for me.
I want to link to a zip file for download. The zip file is in a subdirectory in the wordpress root. I put an empty .htaccess file in that subdirectory, and while I can see the directory index by navigating to I can't access any given file within the directory. When I try to access the file at .zip I get a "Page not found" response from wordpress. I also tried adding the following to the .htaccess file in the subdirectory:
<FilesMatch "\.(zip)$">
Allow from All
</FilesMatch>
I also tried adding the following above the # BEGIN WordPress section of the .htaccess file in my root .htaccess as suggested by the question linked above:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/mydirectoryhere/(.*)$ [OR]
RewriteRule ^.*$ - [L]
</IfModule>
Can anyone help me figure out why this is happening? I'm using custom permalinks in my Wordpress installation with the following configuration:
/%category%/%postname%
Here's the contents of my root wordpress installation directory .htaccess file:
# 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
Thank you!
I want to first point out that I have tried to solutions listed in this post and in every case it either hasn't worked or hasn't been appropriate for what I'm trying to do. I have tried several different methods from several different sites and I'm unable to find anything that works for me.
I want to link to a zip file for download. The zip file is in a subdirectory in the wordpress root. I put an empty .htaccess file in that subdirectory, and while I can see the directory index by navigating to http://domain/subdirectory I can't access any given file within the directory. When I try to access the file at http://domain/subdirectory/file.zip I get a "Page not found" response from wordpress. I also tried adding the following to the .htaccess file in the subdirectory:
<FilesMatch "\.(zip)$">
Allow from All
</FilesMatch>
I also tried adding the following above the # BEGIN WordPress section of the .htaccess file in my root .htaccess as suggested by the question linked above:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/mydirectoryhere/(.*)$ [OR]
RewriteRule ^.*$ - [L]
</IfModule>
Can anyone help me figure out why this is happening? I'm using custom permalinks in my Wordpress installation with the following configuration:
/%category%/%postname%
Here's the contents of my root wordpress installation directory .htaccess file:
# 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
Thank you!
Share Improve this question edited Apr 13, 2017 at 12:37 CommunityBot 1 asked Aug 27, 2015 at 8:12 HendecaHendeca 1367 bronze badges 4 |1 Answer
Reset to default 0Turns out the file was the problem, as @TheDeadMedic suspected. The permissions were 640. After changing them to 644, the problem was solved!
Thanks for the help.
本文标签: htaccessI can access subdirectorybut not files within it
版权声明:本文标题:htaccess - I can access subdirectory, but not files within it 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744902968a2631454.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
.htaccess
? – TheDeadMedic Commented Aug 27, 2015 at 9:36