D
D
DeniSidorenko2020-04-14 11:38:46
htaccess
DeniSidorenko, 2020-04-14 11:38:46

How to change htaccess?

Good afternoon, here is an example of how redirection from a subdomain to a folder of the main domain is going on

RewriteEngine on 
RewriteBase / 
#адрес поддомена
RewriteCond %{HTTP_HOST} ^(www\.)?sub\.domain\.dev$ [NC]
#папка на которую будет происходить переадресация
RewriteCond %{REQUEST_URI} !^/sub/
#сама переадресация
RewriteRule ^(.*)$ sub/$1 [L]


Everything works, the information is taken from the root of the site in the folder that you specified.
But is it possible to create a subdomains folder at the root and put the folder there, and htaccess would take not from the root but from subdomains

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2020-04-14
@shambler81

1. htaccess supports nesting and can be located in any folder, so it will override the higher one.
2. you do not need to redirect, use the regular
DocumentRoot of the sub site. should lead to the /var/www/domain.dev/sub folder (well, or whatever it is for you)
Well, if your admin panel does not allow you to change this path and you are afraid of using your hands.
THEN just make a link . (this is a type of shortcut) supported by the file system itself
1 command.
If it’s completely scrapped, then mc has a graphical version.
Link and enjoy.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question