1

私はリンクを持っています:domain.com/activate/それは機能します、アクティブ化ページで私はフォームを取得します。そして、それを実行すると、次のようになります:domain.com/activate/?code=heresomecodething

しかし、それは機能しません。私の元のURLは次のとおりです。domain.com/index.php?p = activate&code = heresomecodething次のように機能させたい:domain.com/activate/code=heresomecodethingどうすればよいですか?

私のhtaccess:

 RewriteEngine On
RewriteRule ^(.*)/$ index.php?p=$1 [L]

あなたが私を理解してくれることを願っています。

ありがとう!--Marijn

4

1 に答える 1

0

試す:

RewriteEngine On
RewriteRule ^([^/]+)/(.*)$ /index.php?p=$1&$2 [L,NE]

送信するURIはのよう/activate/code=heresomecodethingに見えるので、([^/]+)一致するactivate(.*)一致する、両方とcode=heresomecodethingもとを介して逆参照されます:$1$2

/index.php?p=$1&$2

だろう:

/index.php?p=activate&code=heresomecodething

このルールは、クエリ文字列を使用してURIのように見え、内部的に(舞台裏で/ブラウザは完全に影響を受けない)URIに書き換えるURIのみを取ります。/activate/code=heresomecodething

于 2012-11-02T21:09:12.877 に答える