There is a site on which the api logic is registered in one large system, and frontend in another. The architecture is such

--api ---index.php ---.htaccess --admin ---index.php ---.htaccess --frontend ---index.php ---.htaccess .htaccess 

Now, depending on the request, it is necessary that it redirects to where it should be, for example:

 site.com на frontend site.com/admin на admin site.com/api на api 

Help please set up the .htaccess file.

Thank!

  • the answer to your question is here - DiGiTAL

1 answer 1

Here the moment is what you need:

1) redirect exactly

 RewriteEngine On RewriteRule ^$ /frontend [R=301,L] #или RedirectMatch permanent ^$ /frontend #--- RewriteRule ^admin(/(.*))?$ /new-admin$1 [R=301,L] #или RedirectMatch permanent ^/admin(/(.*))?$ /new-admin$1 

2) the possibility of being at one address to receive information from another place without redirect

 RewriteEngine On RewriteRule ^admin(/(.*))?$ /new-admin$1 [L] #или RewriteRule ^admin(/(.*))?$ /myscript.php?url=$1 [L] 

Something like this...

Ps and this is just as a working example ... you still need to finish to fit your needs