簡體   English   中英

使用.htaccess將根目錄重定向到文件夾

[英]Redirect root to folder with .htaccess

我有以下項目結構:

/app
    /api
    /css
    /img
    /js

我想將所有請求從/app文件夾重定向到子文件夾/api 我嘗試了以下.htaccess代碼,但未成功:

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /api/index.php/$1 [L]

我的Apache已啟用Mod_Rewrite。 任何想法?

將其放在/api/.htaccess文件中:

RewriteEngine on
RewriteBase /app/

RewriteRule ^((?!api/index\.php/).+)$ api/index.php/$1 [NC,L,R]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM