Skip to content

Commit df73824

Browse files
committed
Fixed a bug in apache rewrite rules.
1 parent a357647 commit df73824

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

server/conf/vhost.conf.master

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
<VirtualHost <tmpl_var name='ip_address'>:80>
44
DocumentRoot <tmpl_var name='web_document_root'>
55
ServerName <tmpl_var name='domain'>
6+
7+
<tmpl_if name='alias'>
68
ServerAlias <tmpl_var name='alias'>
7-
RewriteEngine on
8-
9+
</tmpl_if>
910
<tmpl_if name='cgi'>
1011
# cgi enabled
1112
ScriptAlias /cgi-bin/ <tmpl_var name='document_root'>/cgi-bin/
@@ -18,7 +19,7 @@
1819
AddOutputFilter INCLUDES .shtml
1920
</tmpl_if>
2021
<tmpl_if name='suexec'>
21-
# suexec enabled
22+
# suexec enabled
2223
SuexecUserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>
2324
</tmpl_if>
2425
<tmpl_if name='php' op='==' value='mod'>
@@ -37,10 +38,12 @@
3738
AddType application/x-httpd-php .php .php3 .php4 .php5
3839
</tmpl_if>
3940

40-
41+
<tmpl_if name="rewrite_enabled">
42+
RewriteEngine on
4143
<tmpl_loop name="redirects">
4244
RewriteCond %{HTTP_HOST} ^<tmpl_var name='rewrite_domain'> [NC]
4345
RewriteRule ^/(.*)$ <tmpl_var name='rewrite_target'>$1 [<tmpl_var name='rewrite_type'>]
4446
</tmpl_loop>
47+
</tmpl_if>
4548

4649
</VirtualHost>

server/plugins-enabled/apache2_plugin.inc.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ function update($event_name,$data) {
165165
}
166166
}
167167
$tpl->setVar('alias',trim($server_alias));
168+
if(count($rewrite_rules) > 0) {
169+
$tpl->setVar('rewrite_enabled',1);
170+
} else {
171+
$tpl->setVar('rewrite_enabled',0);
172+
}
168173
$tpl->setLoop('redirects',$rewrite_rules);
169174

170175
$vhost_file = escapeshellcmd($web_config["vhost_conf_dir"].'/'.$data["new"]["domain"].'.vhost');

0 commit comments

Comments
 (0)