Apache .htaccess在具有url路由的子域上无法正常工作
我有这个.htaccess文件Apache .htaccess在具有url路由的子域上无法正常工作,apache,.htaccess,mod-rewrite,redirect,Apache,.htaccess,Mod Rewrite,Redirect,我有这个.htaccess文件 RewriteEngine on RewriteBase / RewriteRule ^pdf/([^/]+)/?$ pdf.php?file=$1&post=1 [QSA] RewriteRule ^pdf/([^/]+)/([^/]+)/?$ pdf.php?file=$1&id=$2 [QSA] RewriteRule ^file/([^/]+)?$ file.php?file=$1 [QSA] RewriteRule ^file
RewriteEngine on
RewriteBase /
RewriteRule ^pdf/([^/]+)/?$ pdf.php?file=$1&post=1 [QSA]
RewriteRule ^pdf/([^/]+)/([^/]+)/?$ pdf.php?file=$1&id=$2 [QSA]
RewriteRule ^file/([^/]+)?$ file.php?file=$1 [QSA]
RewriteRule ^file/([^/]+)/([^/]+)?$ file.php?file=$1&find=$2 [QSA]
RewriteRule ^file/([^/]+)/([^/]+)/([^/]+)?$ file.php?file=$1&type=$2&find=$3 [QSA]
RewriteRule ^([^/]+)/graphs/([^/]+)/?$ index.php?route=$1/graphs&view=$2 [QSA]
RewriteRule ^(.*)\.html$ $1.php [NC]
RewriteRule ^(.*)\.html$ $1\.php [T=application/x-httpd-php,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule ^(.*)$ index.php?route=$1 [L,QSA]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
这在sub.domain.com上非常有效
但当我将整个内容复制到new.sub.domain.com时,实际文件被称为“图像”,现在被重定向
因此,如果调用了images/image.png
,它将被发送到index.php?route=images/image.png
而不是预期的图像。它确实存在于请求的位置
谁能解释一下我为什么或哪里做错了
我认为这一部分将真正的文件从重定向的文件中分离出来
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
或者在子域上时会发生变化吗
地点如下:
[works] /subdomains/sub/htdocs/
[doesn't work] /subdomains/sub.sub/htdocs/
apache从服务器根目录运行
/subdomains/
文件夹中的所有子域。像图像一样被调用的文件现在被重定向
这是什么意思?他们是如何被引导的?sub和sub是否共享同一个文档根?我已经修改了这个问题,以包括你所问的问题。