2016-03-26 16 views
0

私はベーグルがデータセンターに到着したときに私たちに知らせるwebsiteを持っています。また、APIを持っています。.htaccessは、Apacheを1週間ほどアップグレードしてから、.htaccessの書き換えを壊してしまうまで、完璧に動作しました。私はそれを破ったのApacheを、更新されるまで、これがうまく働いた/anything.htaccess独自の書き換え書き換え

/api.php?key=anythingにそれが書き換えられなければならない、基本的に

RewriteOptions inherit 
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !favicon.ico 
RewriteCond %{REQUEST_FILENAME} !robots.txt 
RewriteRule ^([^/]*)/?$ api.php?key=$1 [L,QSA] 

:そのうちの一つがこれです。 私はApache/2.4.18になっています。私は(私は、タイムスタンプやIPなどの余分なフィールドを削除した).htaccessファイルのログの詳細度を上げ、これを得た:

[rewrite:trace3] mod_rewrite.c(476): [api.bagelstat.us/sid#2817168][rid#7f2b2803e100/initial] [perdir /home/bagelstatus/public_html/api/] strip per-dir prefix: /home/bagelstatus/public_html/api/ -> 
[rewrite:trace3] mod_rewrite.c(476): [api.bagelstat.us/sid#2817168][rid#7f2b2803e100/initial] [perdir /home/bagelstatus/public_html/api/] applying pattern '^([^/]*)/?$' to uri '' 
[rewrite:trace4] mod_rewrite.c(476): [api.bagelstat.us/sid#2817168][rid#7f2b2803e100/initial] [perdir /home/bagelstatus/public_html/api/] RewriteCond: input='/home/bagelstatus/public_html/api/' pattern='!favicon.ico' => matched 
[rewrite:trace4] mod_rewrite.c(476): [api.bagelstat.us/sid#2817168][rid#7f2b2803e100/initial] [perdir /home/bagelstatus/public_html/api/] RewriteCond: input='/home/bagelstatus/public_html/api/' pattern='!robots.txt' => matched 
[rewrite:trace2] mod_rewrite.c(476): [api.bagelstat.us/sid#2817168][rid#7f2b2803e100/initial] [perdir /home/bagelstatus/public_html/api/] rewrite '' -> 'api.php?key=' 
[rewrite:trace3] mod_rewrite.c(476): [api.bagelstat.us/sid#2817168][rid#7f2b2803e100/initial] split uri=api.php?key= -> uri=api.php, args=key= 
[rewrite:trace3] mod_rewrite.c(476): [api.bagelstat.us/sid#2817168][rid#7f2b2803e100/initial] [perdir /home/bagelstatus/public_html/api/] add per-dir prefix: api.php -> /home/bagelstatus/public_html/api/api.php 
[rewrite:trace2] mod_rewrite.c(476): [api.bagelstat.us/sid#2817168][rid#7f2b2803e100/initial] [perdir /home/bagelstatus/public_html/api/] strip document_root prefix: /home/bagelstatus/public_html/api/api.php -> /api.php 
[rewrite:trace1] mod_rewrite.c(476): [api.bagelstat.us/sid#2817168][rid#7f2b2803e100/initial] [perdir /home/bagelstatus/public_html/api/] internal redirect with /api.php [INTERNAL REDIRECT] 
[rewrite:trace3] mod_rewrite.c(476): [api.bagelstat.us/sid#2817168][rid#7f2b2802f708/initial/redir#1] [perdir /home/bagelstatus/public_html/api/] strip per-dir prefix: /home/bagelstatus/public_html/api/api.php -> api.php 
[rewrite:trace3] mod_rewrite.c(476): [api.bagelstat.us/sid#2817168][rid#7f2b2802f708/initial/redir#1] [perdir /home/bagelstatus/public_html/api/] applying pattern '^([^/]*)/?$' to uri 'api.php' 
[rewrite:trace4] mod_rewrite.c(476): [api.bagelstat.us/sid#2817168][rid#7f2b2802f708/initial/redir#1] [perdir /home/bagelstatus/public_html/api/] RewriteCond: input='/home/bagelstatus/public_html/api/api.php' pattern='!favicon.ico' => matched 
[rewrite:trace4] mod_rewrite.c(476): [api.bagelstat.us/sid#2817168][rid#7f2b2802f708/initial/redir#1] [perdir /home/bagelstatus/public_html/api/] RewriteCond: input='/home/bagelstatus/public_html/api/api.php' pattern='!robots.txt' => matched 
[rewrite:trace2] mod_rewrite.c(476): [api.bagelstat.us/sid#2817168][rid#7f2b2802f708/initial/redir#1] [perdir /home/bagelstatus/public_html/api/] rewrite 'api.php' -> 'api.php?key=api.php' 
[rewrite:trace3] mod_rewrite.c(476): [api.bagelstat.us/sid#2817168][rid#7f2b2802f708/initial/redir#1] split uri=api.php?key=api.php -> uri=api.php, args=key=api.php&key= 

これは、それまで何度も何度もこれをやった

[core:error] [client limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace. 

とエラーが出て起こります以前は起こりません。

RewriteCond ${REQUEST_FILENAME} !api.php 

以前のApacheのバージョンはわかりませんでしたが、2.4の変形です。ここに私の設定です:

Server version: Apache/2.4.18 (Unix) 
Server built: Mar 5 2016 14:36:58 
Cpanel::Easy::Apache v3.32.10 rev9999 
Server's Module Magic Number: 20120211:52 
Server loaded: APR 1.5.2, APR-UTIL 1.5.4 
Compiled using: APR 1.5.2, APR-UTIL 1.5.4 
Architecture: 64-bit 
Server MPM:  event 
    threaded:  yes (fixed thread count) 
    forked:  yes (variable process count) 
Server compiled with.... 
-D APR_HAS_SENDFILE 
-D APR_HAS_MMAP 
-D APR_HAVE_IPV6 (IPv4-mapped addresses disabled) 
-D APR_USE_SYSVSEM_SERIALIZE 
-D APR_USE_PTHREAD_SERIALIZE 
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT 
-D APR_HAS_OTHER_CHILD 
-D AP_HAVE_RELIABLE_PIPED_LOGS 
-D DYNAMIC_MODULE_LIMIT=256 
-D HTTPD_ROOT="/usr/local/apache" 
-D SUEXEC_BIN="/usr/local/apache/bin/suexec" 
-D DEFAULT_PIDLOG="logs/httpd.pid" 
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status" 
-D DEFAULT_ERRORLOG="logs/error_log" 
-D AP_TYPES_CONFIG_FILE="conf/mime.types" 
-D SERVER_CONFIG_FILE="conf/httpd.conf" 

なぜ、このような自体に書き換え私の.htaccessのルール(api.php)はありますか?

答えて

0

あなたはこれらの条件を使用する必要があります。

RewriteOptions inherit 
RewriteEngine On 

# If the request is not for a valid directory 
RewriteCond %{REQUEST_FILENAME} !-d 
# If the request is not for a valid file 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^([^/]+)/?$ api.php?key=$1 [L,QSA]