我设置了VirtualHost
,如下所示:
<VirtualHost *:80>
ServerName ownedmedia.vzweb07.example.co.uk
DocumentRoot /var/www/vhosts/owned_media_microsite/httpdocs
ErrorLog /var/www/vhosts/owned_media_microsite/logs/error_log
CustomLog /var/www/vhosts/owned_media_microsite/logs/access_log combined
SetEnv ENVIRONMENT 'development'
<Directory /var/www/vhosts/owned_media_microsite/httpdocs>
AllowOverride All
allow from all
Options +Indexes
</Directory>
</VirtualHost>
我在DocumentRoot中有一个.htaccess
文件,如下所示:
AddDefaultCharset UTF-8
DirectoryIndex index.php
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ index.php/$1 [L]
当我访问http://ownedmedia.vzweb07.example.co.uk/admin/modules/load/coreg_api_module/rule/1
和var_dump
$_SERVER
数组时,我看到以下内容...(我已经删除了一些不相关的值)。
["DOCUMENT_ROOT"]=>
string(46) "/var/www/vhosts/owned_media_microsite/httpdocs"
["SCRIPT_FILENAME"]=>
string(56) "/var/www/vhosts/owned_media_microsite/httpdocs/index.php"
["REDIRECT_URL"]=>
string(43) "/admin/modules/load/coreg_api_module/rule/1"
["REQUEST_METHOD"]=>
string(3) "GET"
["QUERY_STRING"]=>
string(0) ""
["REQUEST_URI"]=>
string(43) "/admin/modules/load/coreg_api_module/rule/1"
["SCRIPT_NAME"]=>
string(10) "/index.php"
["PATH_INFO"]=>
string(52) "/httpdocs/admin/modules/load/coreg_api_module/rule/1"
["PATH_TRANSLATED"]=>
string(123) "redirect:/index.php/httpdocs/httpdocs/admin/modules/load/coreg_api_module/rule/1/admin/modules/load/coreg_api_module/rule/1"
["PHP_SELF"]=>
string(62) "/index.php/httpdocs/admin/modules/load/coreg_api_module/rule/1"
为什么PATH_INFO
等包含httpdocs
目录?
httpdocs
内的目录甚至没有名为httpdocs
的目录,因此PATH_TRANSLATED
无法正确。
有没有人对为什么会这样做有任何想法?这个项目已经设置好了,并且在其他主机上运行正常,我在这台机器上还有其他vhosts没有遇到同样的问题。
答案 0 :(得分:0)
奇怪的是,我能够通过删除文档根目录中的所有内容然后重新上传来解决这个问题。 也许这是一个错误的htaccess文件。