<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
2012年12月12日 星期三
[Apache] 重定向到子目錄
在根目錄的.htaccess中加入:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
# Some web host will need RewriteBase
# RewriteBase /
# Skip if exist file
RewriteCond %{REQUEST_FILENAME} !-f
# Skip if exist directory
RewriteCond %{REQUEST_FILENAME} !-d
# Redirect all to "/public"
RewriteRule ^(.*)$ /public/$1 [L]
</IfModule>
XAMPP設定VirtualHost
在httpd.conf加入:
<virtualhost>
# Virtual host name
ServerName dev.localhost
<Directory "C:/www">
# Allow .htaccess
AllowOverride all
# Enable access while directory is outside htdocs
Require all granted
</Directory>
</VirtualHost>
在%SystemRoot%\system32\drivers\etc\hosts加入:
127.0.0.1 dev.localhost # IPv4 ::1 localhost # IPv6
訂閱:
文章 (Atom)
