2012-09-13 3 views
0

다른 PHP 및 params 로의 HTML 리디렉션을 원한다면 /subdir/index.php?thread=23-post=12/subdir /에서와 같이 하위가 하위 디렉토리 안에 있습니다. showthread.php? topic = 23 & 주제 = 12. 하지만이 작업을하지 않습니다 :htaccess 새 매개 변수로 리디렉션

RewriteRule ^/test/index\.php?thread=(.*)-post=(.*)$ /test/showthread.php?topic=$1&topic=$2 [R] 

어떤 제안이 있습니까?

덕분에 사전

답변

1

에 당신은 RewriteRule에서 쿼리 문자열에 대해 일치하지 않을 수 있습니다. 규칙이 topic 쿼리 문자열 PARAM 2 가지를 매핑

RewriteCond %{QUERY_STRING} ^thread=([^-]+)-post=(.*)$ 
RewriteRule ^/?test/index\.php$ /test/showthread.php?topic=%1&topic=%2 [L,R] 

참고 : 당신은 RewriteCond%{QUERY_STRING} VAR에 일치하고 % 역 참조를 사용해야합니다.

+0

Perfect. 고맙습니다 – user1667532

관련 문제