Answer the question
In order to leave comments, you need to log in
Redirecting all requests to another domain?
In general, I have two sites on my computer. They lie like this
/localhost/example.com
/localhost/api.example.com
How to make all requests sent to example.com when accessing api.example.com?
In file /localhost/api.example.com/.htaccess tried like this
RewriteEngine on
Options +FollowSymLinks
RewriteCond %{THE_REQUEST} \ (.*)//+(.*)\ [NC]
RewriteRule .* %1/%2 [R=301,L]
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . /localhost/example.com/index.php
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question