K
K
khodos_dmitry2020-08-14 13:22:08
Apache HTTP Server
khodos_dmitry, 2020-08-14 13:22:08

How to create virtual host configs so that they don't redirect to another site?

In general, there are such configs:

<VirtualHost 5.3.111.2:80>
  ServerName mysite.ru
  ServerAlias www.mysite.ru
  ServerAlias *.mysite.ru
  RewriteEngine On
  RewriteCond %{HTTP_HOST} !^www.mysite.ru$
  RewriteCond %{HTTP_HOST} ^((.*)\.)mysite.ru$
  RewriteRule ^/(.*) /%2/$1
  DocumentRoot /home/mysite/public_html
  AssignUserID mysite mysite
  CustomLog /home/mysite/logs/mysite.ru.access.log combined
  ErrorLog /home/mysite/logs/mysite.ru.error.log
  DirectoryIndex index.php
  <Directory /home/mysite/public_html>
        	Options +Includes -ExecCGI
       	 	AllowOverride All
        	Require all granted
  </Directory>
</VirtualHost>

In hosts, I wrote the corresponding entry to redirect to the server.
But mysite.ru opens another site on the same server.
Apache rebooted.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Official account of the Timeweb team, 2020-08-21
@timeweb_team

Check what is written in the config of the site, which, as you say, is opened by mysite.ru. Is this domain also listed there

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question