Reputation: 9007
i want to change my folder structure of my web app,
The current structure is
/websites
.subdomain1
.index.html
.app
.htaccess
index.php
DNS: http://subdomain1.website.com/ ->points to folder of subdomain1
now in current structure the php is located inside same folder, i want to move it out, problem is i need to redirect all requests to old directory that is not a file to be redirected, and include subdomain in header.
Example Current API ENDPOINT
http://subdomain1.website.com/app/token
i want this request instead of going to /subdomain1/app/index.php , i want it to go to /api/index.php and include 'subdomain1' as a header.
so that the my folder structure would become
/website
.subdomain1
.index.html
/api
index.php
and all traffic going to the old /app folder redirected to new folder with subdomain as a header.
current htaccess
Options -MultiViews -Indexes
SetOutputFilter DEFLATE
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^$ index.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
</ifModule>
Upvotes: 1
Views: 876
Reputation: 785471
Change your current .htaccess to this:
Options -MultiViews -Indexes
SetOutputFilter DEFLATE
DirectoryIndex index.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ /api/index.php [L]
Upvotes: 1