-2
次の.htaccessファイルがあります。なぜこの.htaccessがサブディレクトリで動作しないのですか?
問題は、ルートディレクトリでは問題なく、サブディレクトリでは問題なく動作します。 誰もこの問題で私を助けることができますか?
Options +FollowSymLinks -Indexes
RewriteEngine on
RewriteBase/
#non-www to www
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
# index.php to/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(([^/]+/)*[^.]+)index\.php$ /$1 [R=301,L]
#index/123/ to index.php?menu=123
RewriteRule ^index2/([^/]+)/?$ /index2.php?menu=$1 [L]
#index.php?menu=123 to index/123/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index2\.php\?menu=([^&]+)\ HTTP/
RewriteRule ^index2\.php$ http://example.com/index2/%1/? [R=301,L]
# Unless directory, remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ http://example.com/$1 [R=301,L]
# Redirect external .php requests to extensionless url
RewriteCond %{THE_REQUEST} ^(.*)\.php([#?][^\ ]*)?\ HTTP/
RewriteRule ^(.+)\.php$ http://example.com/$1 [R=301,L]
# Resolve .php file for extensionless php urls
RewriteRule ^([^/.]+)$ $1.php [L]
ErrorDocument 404 /404.php
ErrorDocument 403 /403.php
一部のサブディレクトリまたはすべてのサブディレクトリでは機能しませんか?正常に動作しないサンプルURLを提供できますか? –
すべてのサブディレクトリで動作するわけではありません。 – Nevca
実際、 "index.php"を削除するルールはすべてのサブディレクトリで機能しますが、他のサブディレクトリでは機能しません。問題は変数にあると思うが、私はそれを自分で修正するのに十分理解していない。 – Nevca