Answer the question
In order to leave comments, you need to log in
RewriteEngine for subdomains
Good afternoon.
Using the example of the article ( How to make subdomains using .htaccess and Apache settings, namely Server Alias *test.ru? ) I am trying to configure RewriteEngine to support subdomains, for example:
aaa.test.su/news/123 -> /home/test/public_html/index.php?domain=aaa&news/123
abc.test.su -> /home/test/public_html/index.php?domain=abc
aaa.test.su -> /home/test/public_html/index.php?domain=aaa
<VirtualHost *>
ServerAdmin [email protected]
ServerName test.su
DocumentRoot /home/test/public_html/
ServerAlias *.test.su
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([0-9a-zA-Z_\-]+)\.test\.su$
RewriteRule ^(.*)$ index.php?domain=$1 [L]
<Directory /home/test/public_html>
AddDefaultCharset utf-8
AllowOverride None
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
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