2012-02-20 1 views
1

私は、このような.htaccessファイルを持っている:2つのシナリオファイル用のRewiteRuleの使い方は?

RewriteEngine On 
# http://site.com/ru,ua,lt/anything/ 
RewriteRule ^(ru|ua|lt)/([^/]+)/$ index.php?lang=$1&article_id=$2 
# http://site.com/print/ru,ua,lt/anything/ 
RewriteRule ^print/(ru|ua|lt)/([^/]+)/$ print.php?lang=$1&article_id=$2 

まず例(#http://site.com/ru,ua,lt/anything/)が動作していない第二、動作します。状況を解決するのを手伝ってください。

+0

私はこの問題を理解していません。投稿の詳細。 – ThinkingMonkey

答えて

1

まず第一には、これにコードを変更:

Options +FollowSymLinks -MultiViews 
RewriteEngine On 
RewriteBase/

# http://site.com/ru,ua,lt/anything/ 
RewriteRule ^(ru|ua|lt)/([^/]+)/?$ index.php?lang=$1&article_id=$2 [L,NC,QSA] 

# http://site.com/print/ru,ua,lt/anything/ 
RewriteRule ^print/(ru|ua|lt)/([^/]+)/?$ print.php?lang=$1&article_id=$2 [L,NC,QSA] 

その後、あなたのURIを試してみると、それはまだ動作しない場合に報告します。

0

どうしたらうまくいかないのですか?それは動作しない外部ファイル(JS、CSS、Images)のみですか?

これは、2番目のURLに追加のサブディレクトリがあるためです。絶対URLパスを使用して外部ファイルにリンクする必要があります。

+0

echo.GET [lang]とGET [article_id]パラメータでprint.phpを表示しません! – vp1

関連する問題