【发布时间】:2019-08-14 06:48:03
【问题描述】:
目前我有一个“公共”文件夹作为我所有前端代码所在的根目录。
但由于我的公用文件夹包含网站内容和应用程序内容,我想将其进一步拆分。 所以我的想法是:
.htaccess (rewriting public url)
src (php backend code)
public/
web/
index.php
app/
account.php
所以我的问题是,我可以轻松访问这样的页面:
http://example.com/web/index.php
http://example.com/app/account.php
但我想从 URL 中删除“web”和“app”...
http://example.com/index.php
http://example.com/account.php
如何使用 .htaccess 做到这一点?我正在运行 apache 2.4。
编辑
我尝试过的一个例子:
RewriteEngine On
RewriteCond %{REQUEST_URI} !app/
RewriteRule (.*) /app/$1
RewriteCond %{REQUEST_URI} !web/
RewriteRule (.*) /web/$1
【问题讨论】:
标签: php apache .htaccess apache2.4