UPDATED
hello I edit some files to do this:
first you must edit /usr/local/ispconfig/server/plugins-available/apache2_plugin.inc.php
edit this lines
Code:
...
if(count($rewrite_rules) > 0) {
$tpl->setVar('rewrite_enabled',1);
} else {
$tpl->setVar('rewrite_enabled',0);
}
...
to this
Code:
...
if(count($rewrite_rules) > 0) {
$tpl->setVar('rewrite_enabled',1);
} else {
$tpl->setVar('rewrite_enabled',0);
}
$tpl->setVar('rewrite_domain',str_replace('.', '\.', $data['new']['domain']));
...
then change file /usr/local/ispconfig/server/conf/vhost.conf.master
change this
Code:
...
<tmpl_if name="rewrite_enabled">
RewriteEngine on
<tmpl_loop name="redirects">
RewriteCond %{HTTP_HOST} ^<tmpl_var name='rewrite_domain'> [NC]
RewriteRule ^/(.*)$ <tmpl_var name='rewrite_target'>$1 <tmpl_var name='rewrite_type'>
</tmpl_loop>
</tmpl_if>
...
(we remove IF)
to this in both virtual hosts (80 and 443 too)
Code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{http_host} ^<tmpl_var name='rewrite_domain'> [nc]
RewriteRule ^(.*)$ http://www.<tmpl_var name='domain'>$1 [r=301,nc]
RewriteCond %{HTTP_HOST} ^www\.([^.]+)\.<tmpl_var name='rewrite_domain'> [nc]
RewriteRule ^(.*)$ http://%1.<tmpl_var name='domain'>$1 [r=301,nc]
RewriteCond %{REQUEST_URI} !^/sd_
RewriteCond %{HTTP_HOST} !^www\.<tmpl_var name='rewrite_domain'> [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.<tmpl_var name='rewrite_domain'>
RewriteRule (.*) /sd_%1/$1 [L]
<tmpl_loop name="redirects">
RewriteCond %{HTTP_HOST} ^<tmpl_var name='rewrite_domain'> [NC]
RewriteRule ^/(.*)$ <tmpl_var name='rewrite_target'>$1 <tmpl_var name='rewrite_type'>
</tmpl_loop>
</IfModule>
in virtual host 443 change http:// to https://
now domain.com will be redirected (301) to
www.domain.com
and if in domain folder create folder
sd_example will be accessible on
example.domain.com and
www.example.domain.com will be redirected (301) to
example.domain.com
IMPORTANT!!!
For correct function you must change the option
Auto-subdomain to
* in website configuration
There are my files
http://www.free-lance.sk/apache2_plugin.inc.php.txt
http://www.free-lance.sk/vhost.conf.master.txt
Recent comments
1 day 15 hours ago
2 days 19 min ago
2 days 3 hours ago
2 days 4 hours ago
2 days 5 hours ago
2 days 7 hours ago
2 days 8 hours ago
2 days 10 hours ago
3 days 2 hours ago
3 days 3 hours ago