C
C
Castiel2015-09-22 09:43:07
PHP
Castiel, 2015-09-22 09:43:07

How to properly configure apache2.conf?

There is a main site and a subdomain handler (the files of each subdomain are in a separate folder of the main domain), how to properly configure apache2.conf so that only html htm files are redirected to the handler, and static files are taken directly from the
folder folders, well, plus only index.html is taken, and if you specify another file, then a 500 error is issued

RewriteEngine On
  RewriteCond %{HTTP_HOST} ^((.*)\.)site.com$
  RewriteRule ^/(.*) /subd/%2/$1 [L]

must be configured so that static files are issued according to the old rule, and html & htm are redirected to the handler, while the parameters would indicate the subdomain itself and the file name, i.e.
sss1.site.com => /subdomain.php?sid=sss1
sss1.site.com/lalaala.html => /subdomain.php?sid=sss1&p=lalaala.html
sss1.site.com/main.css => / subd/sss1/main.css

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
svd71, 2015-09-22
@svd71

make these settings in the .htaccess file for each site. Not in the apache configuration file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question