http://my_domain.com/forum/index.php/blah_blah_blah
どこにもリダイレクトされないようにしたい。
しかし、私はhttp://my_domain.com/something_else_that_is_not_forum/blah_blah_blah
リダイレクトされたいhttp://my_domain.com/index.php/something_else_that_is_not_forum/blah_blah_blah
したがって、基本的には、http://my_domain.com/forum/
プレフィックスのないものだけをリダイレクトする必要があります。
私はこれを持っています.htaccess
:
<IfModule mod_rewrite.c>
# Options +FollowSymLinks -Indexes
RewriteEngine On
RewriteBase /
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ index.php/$1 [L,QSA]
RewriteRule ^(?!forum.*)(.*)$ index.php/$2 [L,QSA]
</IfModule>
正規表現は私がやりたいことを正確に行うべきだと思いますが、この場合、私は間違っているようです。 http://www.getnocms.com/forum/index.php?action=admin;area=manageboards;sa=newcat;df105e678e9b=e1a979a0631bd203b6794debc16ceced
誰かがそれを正しく行う方法を知っていますか?
編集: 私はこれを使用します
<IfModule mod_rewrite.c>
# Options +FollowSymLinks -Indexes
RewriteEngine On
RewriteBase /
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_URI} !^\/forum
RewriteRule (?!^forum(?:/.*|)$)^(.*)$ /index.php/$1 [L,NC,QSA]
</IfModule>
大まかに言うと、リクエストがファイル、ディレクトリ、またはシンボリックリンクを指していない/forum
場合、そうでない場合、フォーラムで開始されていない場合は、/index.php/url を指します。
論理的に思えますが (まあ、RewriteCond %{REQUEST_URI} !^\/forum
実際には必要ありません)、この URL にアクセスするときにまだ失敗しました:http://www.getnocms.com/forum/index.php?action=admin;area=manageboards;sa=newcat;a5272d5=2fcf142818fc9df2aabb1364942a1d14
もしかしてセミコロンで書き換えルールが効かない?わからない。