简体   繁体   中英

Apache2 rewrite url to chanage 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

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 ie manage.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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