douyin2962 2015-10-06 04:02
浏览 157

Apache2重写url来更改url

i have a php project,here is a url like this

127.0.0.1:1000/manage/api/info

,manage is the root of the project,now i want do this ,when i visit

`127.0.0.1:1000/api/info`

,I could get the host,just ignore the root manage,how can i do this? I have search the stackoverflow but doesn't meet my question,does it can be solved in rewrite? I thik i should config the apache2.conf,if i open the write modle i may work? i use ubuntu 14.04 apache2.4.7

  • 写回答

1条回答 默认 最新

  • douju9272 2015-10-06 04:50
    关注

    You have to set your apache configuration to point to manage folder as your web root. Below is the apache configuration you can add to your vhosts file.

    <VirtualHost *:1000>
    ServerAdmin "webmaster@api.com"
    DocumentRoot "/var/www/html/manage"
    ServerName local.myapiapp.com
    <Directory "/var/www/html/manage">
        Options FollowSymLinks
        AllowOverride All
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1
    </Directory>
    

    Additionaly, you can also add local.myapiapp.com to /etc/hosts file. Then go to browser and put in local.myapiapp.com in the address bar. It will point the root directory i.e. manage.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?