Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache .htaccess在具有url路由的子域上无法正常工作_Apache_.htaccess_Mod Rewrite_Redirect - Fatal编程技术网

Apache .htaccess在具有url路由的子域上无法正常工作

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

我有这个.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/([^/]+)/([^/]+)?$ 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是否共享同一个文档根?我已经修改了这个问题,以包括你所问的问题。