2017-05-21 12 views
0

いくつかのサーバーでは、.htaccessが期待通りに動作します。ローカルにいくつかの問題があります。 .htaccessがこれを含まれている場合Mod_rewriteがすべての環境で動作しない

特定の場合には、次のとおりです。

<IfModule mod_rewrite.c> 
Options +FollowSymLinks 
RewriteEngine on 
## path relative to web root 
RewriteBase/
RewriteRule ^([a-z0-9_]+)$ index.php?action=$1 [L] 
RewriteRule ^([a-z0-9_]+)/([a-zA-Z0-9_]*)/?$ index.php?controller=$1&action=$2&%{QUERY_STRING} [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 

他のいくつかの行があります。しかし、コメントは述べている:だからイムは混乱を避けるために、それを含めない

## rewrite everything else to index.php 

何が起こることは、このルートということです。だから、と思わ

Array ([my_id] => 9) 

:私が見る画面で

public function index(){ 
    print_r($_REQUEST); 
} 

http://localhost/index/myaction/?my_id=9 

このindex.phpファイルによって処理されます「アクション」パラメータは送信されません。どうしましたか? "アクション" -parameterが配信beeingてされ、他のサーバーで

<Directory "/appbasepath"> 
Options FollowSymLinks Multiviews 
MultiviewsMatch Any 
AllowOverride All 
Require all granted 
</Directory> 

: はhttpd.confでは、私はこれを追加しました。

答えて

0

問題が解決しました。 htaccessとhttpd.confの両方でディレクティブを持つ競合がありました。今だけ私は持っています

それは動作します。

関連する問題