A
A
Alexey Mikhailov2020-05-07 19:30:29
htaccess
Alexey Mikhailov, 2020-05-07 19:30:29

Why does the browser see the subdomain as a section of the site (accessed through a slash)?

I have three sites hosted at /home/www/ that I administer in WordPress. Through the admin panel of the host, I started making a test subdomain for one of them (site2.com) in order to transfer a copy of this site there using Duplicator. The admin created a subdomain in the form of a folder: /home/www/site2.com/test and put index.html there.

The problem is that I can't open this index.html in the expected way: test.site1.com/index.html (or https, doesn't matter). It opens like this: https://site2.com/test/index.html, which doesn't work very well for me.

Interestingly, I have already made such a test subdomain on one of these sites, and it opens normally: test.site1.com/index.html,the only thing you need to make sure that http without s is mandatory. I got into the htaccess of the problem site, there is such a stray, is it not the case?:

RewriteEngine on
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [ R=301,L]

Can you tell me how can I solve this problem?

Upd
Solution: I had to comment out one more line from the bottom and top, and everything worked.

IfModule mod_rewrite.c tag
RewriteEngine on
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST }/$1 [R=301,L]
tag /IfModule tag

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SagePtr, 2020-05-07
@SagePtr

Is the virtual host registered in the web server config?
The subdomain is also registered in DNS, does it return the correct IP address?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question