wamp默认的路径是安装目录下的 www 目录,

如果你想运行php代码,就需要将代码放在 www 目录下,

但这样很不方便,能否通过配置的方式,来实现 在别的目录下的 php 代码,也能正常运行和访问到呢。

答案是 可以的。

    Alias /github "h:/github_projects"  

    <Directory "h:/github_projects/">
#Options Indexes FollowSymLinks
#AllowOverride None
#Order allow,deny
#Allow from all Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>

在配置文件 httpd.conf 中,添加上述代码,重启即可。

Alias /github "h:/github_projects"

指定真实路径 h:/github_projects 的别名(映射名)为 /github,

这样就能通过 http://localhost/github/xxxxx 来访问 h:/github_projects目录下的 xxxxx 项目了

完整的配置例子:(解决403和指定别名)

 <VirtualHost *:80>
ServerName localhost
DocumentRoot e:/wamp64/www
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory> Alias /github "h:/github_projects" <Directory "h:/github_projects/">
#Options Indexes FollowSymLinks
#AllowOverride None
#Order allow,deny
#Allow from all Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

参考:http://www.111cn.net/phper/apache/52812.htm         https://stackoverflow.com/questions/38339617/wamp-server-403-forbidden-using-a-public-ip-works-with-localhost-and-ipv4-addre/38347450#38347450

wamp配置虚拟路径(路径别名)的更多相关文章

  1. wamp配置虚拟主机

    ================================================================= 来源参考一:http://wenku.baidu.com/link? ...

  2. wamp 配置虚拟主机

    1.首先打开apache的配置文件httpd.conf,并去掉#Include conf/extra/httpd-vhosts.conf前面的#,启用虚拟主机功能 2.先把localhost配置好,免 ...

  3. php wamp 配置虚拟主机

    apeach  配置: 还有是:E:\wamp\bin\apache\Apache2.4.4\conf 目录下有个 http.conf文件中,有一个需要取消注释, # Virtual hostsInc ...

  4. wamp配置虚拟域名

    1.打开apache下httpd.conf 我的目录是在F:\wamp\bin\apache\apache2.2.22\conf\httpd.conf 2.去掉这两行前面的#注释 LoadModule ...

  5. WAMP配置虚拟目录

    1.启动wamp所有服务,输入localhost或localhost:端口号确保wamp环境正常无误. 2.设置httpd.conf 2.1打开文件:单击wamp在电脑右下角的图标=>wamp= ...

  6. 利用wamp配置虚拟主机

    第一步:打开wamp--Apache--httpd.conf找到# Virtual hosts 一行,把其下面的一行中的#去掉.

  7. 配置虚拟主机并更改Apache默认解析路径

    配置虚拟主机,非常easy 改动以下文件: 加入以下几句话 <VirtualHost *:80> ##ServerAdmin webmaster@dummy-host2.example.c ...

  8. tomcat配置虚拟路径保存、访问图片

    一些项目中往往需要上传一些图片文件之类,一般不建议直接保存在数据库内,往往是讲图片等资源保存在服务器的某个文件夹下,传统做法是上传到部署目录下,通过相对路径进行访问.这样当我们系统需要进行升级,进行全 ...

  9. eclipse配置虚拟路径后,每次启动tomcat都会虚拟路径失效的问题解决

    由于,eclipse启动tomcat部署项目并不是直接把项目放到tomcat的webapps目录下的,而是从我们在eclipse配置的外部tomcat中取出二进制文件,在eclipse内部插件中作为t ...

随机推荐

  1. (数学)Knight's Trip -- hdu -- 3766

    http://acm.hdu.edu.cn/showproblem.php?pid=3766 Knight's Trip Time Limit: 2000/1000 MS (Java/Others)  ...

  2. Alpha阶段敏捷冲刺(七)

    1.站立式会议 提供当天站立式会议照片一张 2.每个人的工作 (有work item 的ID),并将其记录在码云项目管理中: 昨天已完成的工作. 祁泽文:用java完成了错词,已掌握,陌生单词的图标生 ...

  3. A - Playground

    My kid's school cleared a large field on their property recently to convert it into a playing area.  ...

  4. (leetcode162)find peak element

    1题目 A peak element is an element that is greater than its neighbors. Given an input array where num[ ...

  5. Git之初识

    我的Github地址:https://github.com/shinianzongjishinianxin 初见总是美好的,可是我第一次看到github有点纠结,因为看不懂,然而最终半蒙半猜还是注册完 ...

  6. iis支持asp.net4.0的注册命令使用方法

    32位的Windows: 1. 运行->cmd 2. cd C:\Windows\Microsoft.NET\Framework\v4.0.30319 3. aspnet_regiis.exe ...

  7. 【文文殿下】P3740 [HAOI2014]贴海报

    题解 一开始想到离散化,然后暴力模拟.但是存在一种hack数据: [5,7] [1,5] [7,9] 这样会错误的认为第一个区间被覆盖了(因为两个端点被覆盖).所以我们设置一个玄学调参系数,在一个区间 ...

  8. [LNOI2014]LCA(树剖+线段树)

    \(\%\%\% Fading\) 此题是他第一道黑题(我的第一道黑题是蒲公英) 一直不敢开,后来发现是差分一下,将询问离线,树剖+线段树维护即可 \(Code\ Below:\) #include ...

  9. fatal: LF would be replaced by CRLF in index.html

    进入项目目录,在.git文件夹下打开config配置文件,添加上下面两句话: autocrlf = false safecrlf = false 即可

  10. 【ElasticSearch】:QueryDSL

    Search API URI Search Response Body Search Query DSL Response Body Search使用Query DSL语句,相对URI Search功 ...