为什么.htaccess没有';在子目录中不工作?
我有以下.htaccess文件 问题是它在根目录中工作正常,但在子目录中工作不正常。 有人能帮我解决这个问题吗为什么.htaccess没有';在子目录中不工作?,.htaccess,.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
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吗?你希望发生的事情不是对所有子目录都起作用。事实上,删除“index.php”的规则对所有子目录都起作用,但其他子目录则不起作用。A我认为问题出在变量上,但我自己对它们的理解还不足以修改它们。你需要进一步说明它不起作用的含义。我假设您正在请求一个url,例如example.com/foo/bar,并希望example.com/foo/bar.php加载?