14

ファイルまたはディレクトリが存在する場合、書き換えルールをスキップするようにhtacessファイルを調整しようとしていますが、ファイルが存在する場合、URLが別のものに変更されます。なぜこれが起こっているのか分かりません。これが私のhtaccessファイルです:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^project/([^/\.]+)/?$ index.php?view=project&project=$1 [L]
RewriteRule ^for/content/ag index.php?view=opening&section=ag [L]
RewriteRule ^for/content/bus index.php?view=opening&section=bus [L]
RewriteRule ^for/content/fcs index.php?view=opening&section=fcs [L]
RewriteRule ^for/content/market index.php?view=opening&section=market [L]
RewriteRule ^for/content/trade index.php?view=opening&section=trade [L]
RewriteRule ^for/content/teched index.php?view=opening&section=teched [L]
RewriteRule ^for/content/([^/\.]+)/?$ index.php?view=content_area&section=$1 [L]

ディレクトリ/project/ ntiは、index.phpファイルとともに存在します。アドレスmywebsite.com/folder/project/ntiを入力すると、mywebsite.com / folder / project / nti /?view = project&project=ntiに変わります。サンプルサイトがサブフォルダーにあるテストサーバーにこれを適用していますが、実装すると、ルートWebサーバーフォルダーになります。

助けてくれてありがとう!

4

1 に答える 1

29

余分なものを削除[OR]し、次のようなコードを作成します。

# If the request is not for a valid directory
RewriteCond %{REQUEST_FILENAME} !-d
# If the request is not for a valid file
RewriteCond %{REQUEST_FILENAME} !-f
# If the request is not for a valid link
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^project/([^/.]+)/?$ index.php?view=project&project=$1 [L,NC,QSA]
于 2012-04-05T14:51:39.283 に答える