2011-05-16 18 views
0

を変更するには:htaccessファイルは、私がURLを持っているURL

また、私は私がしようとしてきた

'で' フォルダにある.htaccessファイルを修正しています

http://example.com/at 
and want to get: 
http://example.com/at/index.php?at= 

http://example.com/at/ 
and want to get: 
http://example.com/at/index.php?at= 

http://example.com/at/1asSde 
and want to get: 
http://example.com/at/index.php?at=1asSde 

RewriteEngine On 
RewriteRule (.*)$ index.php?at=$1 [QSA,L] 

後でサイトのスクリプトを実行しているときにエラーが発生しています。

正しい結果を得るために代わりに何を試すことができますか?

ありがとうございました。

+0

あなたが書き換え条件 –

+0

を逃していますあなたは '$ _GET ['at']'を印刷しようとしましたか? – AndersTornkvist

+0

どのような種類のエラー? –

答えて

0

は、あなたはとても長いat/index.php物理場所であるようatのルールを必要としない、次の

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

を試してみてください。私はatのよりよい一致を作成することをお勧めします。たとえば、英数字のみの場合は、(.*)(\w+)に変更します。

0

RewriteRule ^at/(.*)$ /at/index.php?at=$1 [QSA,L]

0
RewriteEngine On 
RewriteRule ^at/(.*)$ index.php?at=$1 [QSA,L] 
0

あなたが取得しようとしているリソースは、URLを書き換える前に存在していないことを確認したくなるでしょう:

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule (.*)$ index.php?at=$1 [QSA, L] #didn't test to make sure this line actually works. 
関連する問題