1.httpd.conf設定
LoadModule rewrite_module modules/mod_rewrite.so
需要拿掉註解#啟用
2.在httpd.conf 增加對應資料夾別名
Alias /shop55 "C:/website/www/laravel55/shop55/public" <Directory "C:/website/www/laravel55/shop55/public"> </Directory> Alias /white55 "C:/website/www/laravel55/white55/public" <Directory "C:/website/www/laravel55/white55/public"> </Directory>
3.在對應的專案資料夾public下需要新增 .htaccess檔案 並寫入RewriteBase /Alias name
舉例:white55下的 C:/website/www/laravel55/white55/public
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
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
</IfModule>
4.重啟apache
c:\Apache24\bin\httpd -k restart
沒有留言:
張貼留言