S
S
Scorpion42021-06-15 20:39:59
htaccess
Scorpion4, 2021-06-15 20:39:59

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

1 answer(s)
D
dodo512, 2021-06-15
@dodo512

/.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 question

Ask a Question

731 491 924 answers to any question