0

URLの$_GET['p']変数を独自の変数に変更しようとしていますが、?=はありません。

例:
www.example.com/?p=about to www.example.com/about

問題は、私の少しのhtaccessコードがサブフォルダーにも反応することです。

例として自分の画像フォルダにアクセスしたい場合は、
www.example.com / images /?p=imagesを取得します。

.htaccessがサブフォルダーを無視するようにするにはどうすればよいですか?

これは私が現在使用している.htaccessです
RewriteEngine on
RewriteBase /
# Rewrite page include
#RewriteRule ^(\w+)$ index.php?p=$1

私の悪い説明でごめんなさい。

-バナナ

4

1 に答える 1

1
RewriteEngine on

# ignore existing files (only apply to non-file)
RewriteCond %{REQUEST_FILENAME} !-f

#ignore folders (only apply to non-folder)
RewriteCond %{REQUEST_FILENAME} !-d

# here you might also want to exclude some specific locations...
RewriteCond %{REQUEST_URI} !^(images|css|js)/

# finally, apply the rule...
RewriteRule ^(\w+)$ index.php?p=$1 [L]

すべてのRewriteCond条件が連鎖しています(すべてが合格した場合にのみ、ルールが適用されます)。

于 2012-07-12T15:42:26.660 に答える