0

I'm trying to create a rule in .htaccess using the following conditions:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^year=2013$ 
RewriteRule ^/media/news/info.php$ /media/news/month=Month&date=1 [L,R=301]

Apparently this rule should work , but it doesn't since /media/news are dynamically generated and apache doesn't find those directories, and bounces the request to the scripting language who returns a 404.

My question is how can i "make" apache disregard the validation for dynamic directories and just make the user follow the RewriteRule ?

4

1 に答える 1

0

RewriteCondRewriteRuleの条件がクエリに一致する場合、RewriteRuleは HTTP 301 を使用してリダイレクトを行い、ターゲットの存在をチェックしません。

つまり、ブラウザの場所が変更されているはずです。変更されていない場合は、RewriteCondが URI と一致していないか、RewriteRuleの条件が一致していません。

Apache に /media/news/ URL を認識させたい場合はRewriteRule、もちろん別の が必要です。

于 2013-03-19T13:18:52.657 に答える