0

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

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

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 ####################

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
4

1 回答 1

1

我的想法倒退了。诀窍是先“重写” wp 链接,然后再运行 amember protect .htaccess。以下是最终为我工作的内容。特别注意 WP 重写的最后一行中缺少的 [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 ####################
于 2011-08-11T10:47:55.347 回答