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>

沒有留言:

張貼留言