search

Home  >  Q&A  >  body text

Domain name - How does Apache rewrite the access to the root directory to directly access a website under that directory?

Assumption: I have deployed 3 websites under /var/www (i.e. 3 directories, a, b, c), and there is also an index.html
under /var/www Now the domain name example.com has been mapped to the server IP
When accessing directly through example.com, you will see index.html
example.com/a is visiting website a
example.com/b is accessing website b
example.com/c is accessing the c website

If I want to achieve this effect now:
example.com/b or example.com/b/xxxx is visiting website b
example.com/c or example.com/c/xxxx is visiting the c website
example.com is visiting a website

How to configure?

Thanks!

滿天的星座滿天的星座2806 days ago464

reply all(1)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-05-16 17:06:59

    Can I use the rewrite function
    Place a .htaccess file under example.com/b/xxxx and use regular expression matching in it
    ^b/xxxx/$ b/$1
    Finally, in httpd.conf (/etc/httpd/conf/httpd.conf), change 'AllowOverride None' to 'AllowOverride All' (if necessary)

    reply
    0
  • Cancelreply