Apache虚拟主机

Apache虚拟主机,apache,virtual,host,Apache,Virtual,Host,我已经被这个问题困扰了很久:-(,基本上我的“Alias”标记在我的c:\xampp\apache\conf\virtual-hosts.conf中不起作用。Url工作正常,但不起作用。Alias标记的目录结构存在于我的本地主机中(我已检查) 这是我为许多网站之一设置的 NameVirtualHost *:80 <VirtualHost *:80> AcceptPathInfo On ServerName raghu.tkiportal Alias /simplesaml C:

我已经被这个问题困扰了很久:-(,基本上我的“Alias”标记在我的c:\xampp\apache\conf\virtual-hosts.conf中不起作用。Url工作正常,但不起作用。Alias标记的目录结构存在于我的本地主机中(我已检查)

这是我为许多网站之一设置的

NameVirtualHost *:80
<VirtualHost *:80>   
AcceptPathInfo On
ServerName raghu.tkiportal
Alias /simplesaml C:/xampp/htdocs/tki_portal4.2/extension/feide/lib/simplesaml/www
DocumentRoot C:/xampp/htdocs/tki_portal4.2

<Directory C:/xampp/htdocs/tki_portal4.2>
  Options Indexes FollowSymLinks MultiViews
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>



LogLevel debug
ErrorLog C:/xampp/apache/logs/raghu_tki_portal_error.log
CustomLog C:/xampp/apache/logs/raghu_tki_portal_access.log combined
ServerSignature On
RewriteEngine On


RewriteRule ^/var/([^/]+/)?storage/images(-versioned)?/.*  /index_image_tki_portal.php [L]

RewriteRule !(^/design|^/var|.*/storage|^/var/storage|^/var/.*/cache|^/var/cache|^/extension/.*/design|^/kernel/setup/packages|^/packages|^/share/icons).*\.(gif|css|jpg|png|jar|js|ico|pdf|swf|mov|html|xml|xsl|htc)$ /index.php

</VirtualHost>
NameVirtualHost*:80
上的AcceptPathInfo
ServerName raghu.tkiportal
别名/simplesaml C:/xampp/htdocs/tki_portal4.2/extension/feide/lib/simplesaml/www
DocumentRoot C:/xampp/htdocs/tki_portal4.2
选项索引跟随符号链接多视图
不允许超限
命令允许,拒绝
通融
日志级调试
ErrorLog C:/xampp/apache/logs/raghu\u tki\u portal\u error.log
CustomLog C:/xampp/apache/logs/raghu\u tki\u portal\u access.log组合
服务器签名
重新启动发动机
重写规则^/var/([^/]+/)?存储/图像(-versioned)?/.*/index_image_tki_portal.php[L]
重写规则!(^/design^/var^.*/storage^/var/storage^/var/*/cache^/var/cache^/extension/*/design^/kernel/setup/packages^/share/icons)。*\.(gif | css | jpg | png | jar js ico | pdf | swf | mov | html | xslc
你们看到我的设置有什么问题吗?同样的设置在linux机器上也适用

任何帮助都将不胜感激…谢谢各位

RD

尝试此操作(因为Windows使用\而不是/在路径名中):

我以前没有在Windows上运行过Apache,但认为路径中的/是问题所在。

是否正常工作

然后读取您的配置,恐怕最后一条重写规则优先于您的别名(或在之后应用),因此您的/simplesaml/index.[html.php]被重定向到/index.php

重写规则包含异常,请尝试在异常列表中添加simplesaml:

RewriteRule !(^/simplesaml|^/design|^/var|.* ...

要对此进行调试,您可以激活RewriteLogLevel 9和Rewrite Log/absolute/path/To/debug.Log,并检查/simplesaml上的调用是否由mod_Rewrite重写我必须包含一个重写条件…如果它是simplesaml,那么就不要应用最后一个重写规则。感谢regilero提供的有关重写规则的提示。

感谢karudzo的回复…只是尝试了一下,但没有起作用:-(你在“是到”中更改了它(我忘了提及它)?很抱歉,我的答案似乎不正确。看起来Apache在传递到Windows的文件系统部分之前,内部处理了“/”到“\”的问题。是的,这也改变了karudzo。有趣的是,如果我将别名行从virtua-host.conf复制并粘贴到httpd.conf,它对URL有效,但不适用于:-([已解决]我必须包含一个RewriteCond…表示如果它是simplesaml,则不应用最后一个重写规则。感谢regilero提供的有关重写规则的提示。因此,请选择响应或upvote,对于通过google post来到这里的人,请选择您的最终修复
RewriteRule !(^/simplesaml|^/design|^/var|.* ...