bodruk
bodruk

Reputation: 3262

Redirect root to folder with .htaccess

I have the following project structure:

/app
    /api
    /css
    /img
    /js

I want to redirect all the requests from /app folder to the sub folder /api. I tried the following .htaccess code, without success:

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

My Apache has Mod_Rewrite enabled. Any idea?

Upvotes: 1

Views: 61

Answers (1)

anubhava
anubhava

Reputation: 784938

Place this in /api/.htaccess file:

RewriteEngine on
RewriteBase /app/

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

Upvotes: 2

Related Questions