Thứ Bảy, 29 tháng 3, 2014

Sử dụng Mod Rewrite trong Apache 2.4.6 trên Ubuntu 13.10

Chúng ta thiết lập trên 2 file:
/etc/apache2/apache2.conf
/etc/apache2/sites-available/000-default.conf
/etc/apache2/sites-enabled/000-default.conf chuyển sang /etc/apache2/sites-available/000-default.conf
Sửa apache2.conf và thêm
<Directory /home/my_site/public_html/>
    #YOUR SETTINGS
</Directory>
Sửa sites-available/000-default.conf và thay thế <VirtualHost *:80> thành <VirtualHost localhost:80>
Thêm vào file sites-available/000-default.conf nội dung sau
<VirtualHost mysite.localhost:80> 
    ServerName mysite.localhost

    ServerAdmin webmaster@mysite.localhost

    DocumentRoot /home/my_new_site_public_html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Sửa /etc/hosts/ 
 IP của mysite.localhost từ127.0.1.1 thành 127.0.0.1
Truy cập http://mysite.localhost & http://localhost/


Source: http://stackoverflow.com/ 

0 nhận xét:

Đăng nhận xét