0

mydomain.com/forum/は実際のディレクトリです。

これらの2行を.htaccessに追加する場合:

RewriteRule ^forum/([a-zA-Z0-9_-]+)/new-thread /forum/new-thread.php?comm=$1 [L]
RewriteRule ^forum/([a-zA-Z0-9_-]+) /forum/community.php?comm=$1 [L]

mydomain.com/forum/AKAmydomain.com/forum/index.phpは、これらの行によって変更されることになっているすべてのルールと同様に、500エラーをスローします。私は何が間違っているのですか?

4

1 に答える 1

0

正規表現に境界を追加する必要があります。たとえば、正規表現は両方に^forum/([a-zA-Z0-9_-]+)一致するため、ルールがループしています。文字列の最後の一致を正規表現に追加するか、条件を追加して書き換えを停止することができます。/forum/new-thread/forum/community$

RewriteRule ^forum/([a-zA-Z0-9_-]+)/new-thread$ /forum/new-thread.php?comm=$1 [L]
RewriteRule ^forum/([a-zA-Z0-9_-]+)$ /forum/community.php?comm=$1 [L]

また

RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule ^ - [L]

RewriteRule ^forum/([a-zA-Z0-9_-]+)/new-thread /forum/new-thread.php?comm=$1 [L]
RewriteRule ^forum/([a-zA-Z0-9_-]+) /forum/community.php?comm=$1 [L]

また

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^forum/([a-zA-Z0-9_-]+)/new-thread /forum/new-thread.php?comm=$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^forum/([a-zA-Z0-9_-]+) /forum/community.php?comm=$1 [L]
于 2012-09-25T02:46:57.303 に答える