admin管理员组文章数量:1384278
I would like to redirect all of the following urls if a WordPress user is not logged in (or WordPress cookie is set) using .htaccess.
.html
.html#page=1
.html#page=2
etc etc
This is what I have tried :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_COOKIE} !.*wordpress_logged_in.*$ [NC]
RewriteCond %{REQUEST_URI} ^(.*?/?)wp-content/uploads/sample_pdf/(.+) [NC]
RewriteRule . http://%{HTTP_HOST}%1/wp-login.php?redirect_to=%{REQUEST_URI} [L,QSA]
</IfModule>
and
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_COOKIE} !.*wordpress_logged_in.*$ [NC]
RewriteCond %{REQUEST_URI} ^(.*?/?)wp-content/uploads/sample_pdf/.* [NC]
RewriteRule . http://%{HTTP_HOST}%1/wp-login.php?redirect_to=%{REQUEST_URI} [L,QSA]
</IfModule>
Both of these options redirect the first URL :
But not the others.
Can you please let me know where my regex is going wrong & why it's not grabbing everything in the /sample_pdf
directory.
本文标签: htaccessRedirect files in uploads directory if WordPress user not logged in
版权声明:本文标题:htaccess - Redirect files in uploads directory if WordPress user not logged in 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744534956a2611256.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论