modRewire說明:https://blog.hinablue.me/apache-note-about-some-rewrite-note-2011-05/
alias 說明:http://phorum.study-area.org/index.php?topic=21235.0
同一個IP不同目錄專案顯示改寫:
apache centos 7
1.cmd 下開啟編輯設定檔案
sudo vi /etc/httpd/conf/httpd.conf
2.編輯檔案
Alias /shop55 "/var/www/html/shop55/public"AllowOverride all RewriteEngine On #不顯示目錄結構 Options FollowSymLinks
Alias /white55 "/var/www/html/white55/public"AllowOverride all RewriteEngine On #不顯示目錄結構 Options FollowSymLinks
3.在對應的laravel public資料夾底下設定 .htaccess
第一個 ..htaccess
第二個 .htaccessOptions -MultiViews RewriteEngine On # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /$1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] # Handle Authorization Header RewriteCond %{HTTP:Authorization} . RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase /shop55
Options -MultiViews RewriteEngine On # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /$1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] # Handle Authorization Header RewriteCond %{HTTP:Authorization} . RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase /white55
重新啟動:
sudo systemctl restart httpd.service
另外一種設定方法
1.cmd 下開啟編輯設定檔案
sudo vi /etc/httpd/conf/httpd.conf
sudo vi /etc/httpd/conf/httpd.conf
然後在DNS代管設定,填入A 紀錄 主機名稱別名:shop55 IP:對應IP,等待生效。
就可以使用
shop55.xxxxxx.tw
white55.xxxxx.tw
進入。
沒有留言:
張貼留言