合并 .htaccess 文档 - Wordpress 和 aMember
如何合并这两个 .htaccess 文件?我一直触发 500 个错误。
- 每个版本都可以单独使用,效果非常好。
- Amember .htaccess (1st) 保护访问我认为应该首先实施。
- 干净的 URL 需要 WordPress .htaccess(第二个)。
htaccess 1)
########### AMEMBER START #####################
Options +FollowSymLinks
RewriteEngine On
## allow access for product #12
RewriteCond %{HTTP_COOKIE} amember_nr=([a-zA-Z0-9]+)
RewriteCond /home/www/changed.tld/amember/data/new_rewrite/%1-12 -f
RewriteRule ^(.*)$ - [L]
## if user is not authorized, redirect to login page
# BrowserMatch "MSIE" force-no-vary
RewriteCond %{QUERY_STRING} (.+)
RewriteRule ^(.*)$ http://changed.tld/amember/plugins/protect/new_rewrite/login.php?v=-12&url=%{REQUEST_URI}?%{QUERY_STRING} [L,R]
RewriteRule ^(.*)$ http://changed.tld/amember/plugins/protect/new_rewrite/login.php?v=-12&url=%{REQUEST_URI} [L,R]
########### AMEMBER FINISH ####################
htaccess 2)
# BEGIN WordPress
<IfModule mod_rewrite.c>
#RewriteEngine On
RewriteBase /localsearch/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /localsearch/index.php [L]
</IfModule>
# END WordPress
AddType application/octet-stream .pdf
How would one go about merging these two .htaccess files? I keep triggering 500 errors.
- Each version works beautifully on its own.
- Amember .htaccess (1st) protects access I believe should be implemented first.
- Wordpress .htaccess (2nd) is needed for clean urls.
htaccess 1)
########### AMEMBER START #####################
Options +FollowSymLinks
RewriteEngine On
## allow access for product #12
RewriteCond %{HTTP_COOKIE} amember_nr=([a-zA-Z0-9]+)
RewriteCond /home/www/changed.tld/amember/data/new_rewrite/%1-12 -f
RewriteRule ^(.*)$ - [L]
## if user is not authorized, redirect to login page
# BrowserMatch "MSIE" force-no-vary
RewriteCond %{QUERY_STRING} (.+)
RewriteRule ^(.*)$ http://changed.tld/amember/plugins/protect/new_rewrite/login.php?v=-12&url=%{REQUEST_URI}?%{QUERY_STRING} [L,R]
RewriteRule ^(.*)$ http://changed.tld/amember/plugins/protect/new_rewrite/login.php?v=-12&url=%{REQUEST_URI} [L,R]
########### AMEMBER FINISH ####################
htaccess 2)
# BEGIN WordPress
<IfModule mod_rewrite.c>
#RewriteEngine On
RewriteBase /localsearch/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /localsearch/index.php [L]
</IfModule>
# END WordPress
AddType application/octet-stream .pdf
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的想法是倒退的。技巧是首先“重写”wp 链接,然后运行 amember Protect .htaccess。以下是最终为我工作的内容。特别注意 WP 重写的最后一行中缺少的 [L]。
My thinking was backwards. Trick was to 'rewrite' the wp links first and then run the amember protect .htaccess next. Below is what ended up working for me. Specifically note the missing [L] in the last line of the WP rewrite.