简体   繁体   English

Apache2将网址重写为更改网址

[英]Apache2 rewrite url to chanage url

i have a php project,here is a url like this 我有一个PHP项目,这是一个像这样的URL

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? 我已经搜索了stackoverflow但不满足我的问题,可以重写解决吗? I thik i should config the apache2.conf,if i open the write modle i may work? 我想我应该配置apache2.conf,如果我打开写模型,我可以工作吗? i use ubuntu 14.04 apache2.4.7 我使用ubuntu 14.04 apache2.4.7

You have to set your apache configuration to point to manage folder as your web root. 您必须将apache配置设置为指向将管理文件夹作为您的Web根。 Below is the apache configuration you can add to your vhosts file. 以下是您可以添加到vhosts文件中的apache配置。

<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. 另外,您还可以将local.myapiapp.com添加到/ etc / hosts文件中。 Then go to browser and put in local.myapiapp.com in the address bar. 然后转到浏览器,然后在地址栏中输入local.myapiapp.com。 It will point the root directory ie manage. 它将指向根目录,即管理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM