Answer the question
In order to leave comments, you need to log in
Redirects in .htaccess, redirect depending on url?
Hello. I must say right away that I do not need a solution to the problem of a subdomain.
So, there is a hosting where there are two folders:
- frontend (on Vue)
- api (php)
And the .htaccess file, so, set it up like this:
if the user goes (or sends a request) to https://domain.ru/ api/* , then the redirect would be made to the api folder,
if the user goes (or sends a request) to https://domain.ru/* (except for /api), then the redirect would be made to the frontend.
Is it even possible?
Answer the question
In order to leave comments, you need to log in
/.htaccess
RewriteEngine On
RewriteRule .* frontend/$0 [L]
/frontend/.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.html [L]
/api/.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question