.htaccessのRewriteCondについて
「https://xxx.com/hoge/key/***」等、「/hoge/key/」以下のURLはそのまま表示、
「https://xxx.com/hoge/***」等、「/hoge/key/」を除く「/hoge/」以下のURLは転送したいと思います。
で、以下の様に記述したのですが、うまくいきません。
RewriteRule ^hoge/key/(.*)$ /hoge/key/index.php?p=$1 [NC,QSA,L] RewriteCond %{REQUEST_URI} !^hoge/key/ RewriteRule ^hoge/(.*)$ /hoge/index.php?p=$1 [R=301,L]
https://xxx.com/hoge/***
↓
https://xxx.com/hoge/index.php?p=***
で問題なし。
https://xxx.com/hoge/key/***
↓
https://xxx.com/hoge/index.php?p=key/***
で問題あり。
RewriteCondで「/hoge/key/」以下のフォルダを除く指定をしたいのですが、どの様に記述すれば良いのでしょうか?
RewriteCond %{REQUEST_URI} !^hoge/key RewriteCond %{REQUEST_URI} !^hoge/key/ RewriteCond %{REQUEST_URI} !^/hoge/key RewriteCond %{REQUEST_URI} !^/hoge/key/ RewriteCond %{REQUEST_URI} !^hoge/key$ RewriteCond %{REQUEST_URI} !^hoge/key/$ RewriteCond %{REQUEST_URI} !^/hoge/key$ RewriteCond %{REQUEST_URI} !^/hoge/key/$ RewriteCond %{REQUEST_URI} !^hoge/key/(.*)$ RewriteCond %{REQUEST_URI} !^hoge/key/(.*)$ RewriteCond %{REQUEST_URI} !^/hoge/key/(.*) RewriteCond %{REQUEST_URI} !^/hoge/key/(.*)$
等、思いつく限りの方法で記述したのですが、何ら動作は変わりません。
RewriteCond %{REQUEST_URI} !^hoge/key/ RewriteRule ^hoge/(.*)$ /hoge/index.php?p=$1 [R=301,L]
上記の2行を削除すると、
https://xxx.com/hoge/key/***
が問題なく表示されるので、RewriteCondの記述方法が間違ってると思うのですが。。。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。