簡單去除 url 中的 public
將 public 中的 index.php 複製一份
- 將複製的 index.php,放到你要的資料夾位置。
例如:原本的 url 是: www.domain.com/public,那 index.php 複製到 www.domain.com 資料夾之下。 - 修改 index.php 如下,就完成囉:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/\
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php

從平面設計漸漸轉職到前端網頁,日常就是追劇、看綜藝大笑來撫平身心。
『沒事多學習,多學習好事。』來鼓勵躺平的自己。
喜歡我的文章請幫我按讚哦!信箱:doublinlin@gmail.com