【问题标题】:Create Alias for localhost with Apache config file using PHP - XAMPP使用 PHP - XAMPP 使用 Apache 配置文件为 localhost 创建别名
【发布时间】:2017-02-08 05:43:15
【问题描述】:
I installed XAMPP on my windows machine
I changed the DocumentRoot and Directory paths to
C:\dev\CustomCloud\prod 

因为我确实在 windows 上运行了 XAMPP,所以我改为指向我需要设置和修改的代码。本地主机我现在看到大量 404 错误

我指向的这个 PHP 代码正在尝试解析 localhost/matchmaking/ 的别名

例子:

C:\dev\CustomCloud\prod\assets 

http://localhost/matchmaking/assets/

如何让 apache /xampp/ php 使用别名?

对于 MS 项目 asp.net,使用带有 IIS 的虚拟目录很容易,但我正在查看这篇文章 http://httpd.apache.org/docs/2.4/urlmapping.html

那么我会做类似AliasScriptAliasMatch 的事情吗?

 Alias "/docs" "/var/web" ... 
 ScriptAliasMatch "^/~([a-zA-Z0-9]+)/cgi-bin/(.+)"   "/home/$1/cgi-bin/$2"

在我的配置中

  #DocumentRoot "C:/xampp/htdocs"
  #<Directory "C:/xampp/htdocs">
  #"C:/dev/CustomCloud/prod"
  DocumentRoot "C:/dev/CustomCloud/prod"
  <Directory "C:/dev/CustomCloud/prod">

【问题讨论】:

  • 请粘贴您的配置。
  • 如果可能的话,您可以更改 Windows 主机 superuser.com/questions/249723/…
  • @CalosKao 这是我在 apache config 中修改的唯一部分
  • @kumarsher45 不——不是这样

标签: php apache


【解决方案1】:

尝试将此添加到配置中,然后重新加载/重新启动服务。

Alias "/matchmaking/assets" "C:\dev\CustomCloud\prod\assets"

【讨论】:

  • 太棒了!那么我真的不想要assets,而是在比赛中升级吗?例如"/matchmaking/" "c:\dev\CustomCloud\prod"
  • @JeremyMiller 是的。
猜你喜欢
  • 1970-01-01
  • 2012-03-31
  • 2011-04-26
  • 2015-12-16
  • 2013-07-04
  • 2016-05-07
  • 1970-01-01
  • 1970-01-01
  • 2015-01-05
相关资源
最近更新 更多