I
I
Ilya Beloborodov2016-04-08 23:19:39
Apache HTTP Server
Ilya Beloborodov, 2016-04-08 23:19:39

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

But nothing happens

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question