Reputation: 4962
I have the following file structure
- example.com
- - app
- - - index.html
- - api
- - - web
- - - - index.php
How can I redirect my domain local.example.com to app/* and local.example.com/api/ to api/web* ?
this one does it all, expects it redirects to /api/ instead of /api/web.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^local\. [NC]
RewriteRule ^(?!(?:api|app)/)(.*)$ /app/$1 [L]
Upvotes: 1
Views: 43
Reputation: 785146
Place this rule in root .htaccess (1 level above app
directory):
RewriteEngine On
RewriteCond %{HTTP_HOST} ^local\. [NC]
RewriteRule ^(?:api|app)(/(?!web).*)?$ /app$1 [L,NC]
Upvotes: 1