HTTP目錄別名

說明:
當一個網站目錄特別長時,例:http://www.tarena.com/china/hebei/bbs,我們可以給它起個別名來代替這個長的名字
步驟:
1. 搭建Apache Http網站服務平臺
yum -y install httpd* (默認站點目錄/var/www/html)

  1. 創建測試站點
    [root@localhost ~]# mkdir -p /var/www/html/china/hebei/bbs
    [root@localhost ~]#vim /var/www/html/china/hebei/bbs /index.html
    <html>
    <head><title>This is a Alias test Page!!!</title>
    <body>
    <h1>This is a bbs Bie Ming test Page!!!</h1>
    </body>
    </head>
    </html>
  2. 修改主配置文件
    [root@localhost ~]# vim /etc/httpd/conf/httpd.conf
    Alias /bbs "/var/www/html/china/hebei/bbs" //在配置文件中添加此語句
  3. 啓動服務測試
    [root@ser1 ~]# service httpd restart
    http://www.tarena.com/china/hebei/bbs
    HTTP目錄別名
    http://www.tarena.com/bbs
    HTTP目錄別名
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章