【问题标题】:Merging .htaccess Documents - Wordpress and aMember合并 .htaccess 文档 - Wordpress 和 aMember
【发布时间】:2011-10-24 19:36:22
【问题描述】:

如何合并这两个 .htaccess 文件?我一直触发 500 个错误。

  • 每个版本都可以独立运行。
  • Amember .htaccess (1st) 保护访问,我认为应该首先实施。
  • 干净的 url 需要 Wordpress .htaccess (2nd)。

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

【问题讨论】:

    标签: wordpress .htaccess mod-rewrite url-rewriting amember


    【解决方案1】:

    我的想法是倒退的。诀窍是先“重写” wp 链接,然后再运行 amember protect .htaccess。以下是最终为我工作的内容。特别注意 WP rewrite 的最后一行中缺少的 [L]。

    # 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 
    </IfModule>
    
    # END WordPress
    
    ########### 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 ####################
    

    【讨论】:

    • @Puggan Se 低代表你必须等待几个小时才能接受你自己的答案。
    • 啊哈,不知道,我自己从来没有问过什么
    • 不得不等待 3 天。现在标记。 :)
    猜你喜欢
    • 2015-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-21
    • 2021-07-08
    相关资源
    最近更新 更多