;
+ close FH;
+
+ $__package = valid_package_name($__filename);
+ #wrap the code into a subroutine inside our unique package
+ my $__eval = qq{package $__package; use subs qw(exit); sub exit { } sub handler { local \$0='$__filename'; $__sub; }};
+ {
+ # hide our variables within this block
+ my($__filename,$__mtime,$__package,$__sub);
+ eval $__eval;
+ }
+ if ( $@ )
+ {
+ warn $@;
+ return 500;
+
+ }
+
+ #cache it unless we're cleaning out each time
+ if ( ! $__delete )
+ {
+ #$Cache{$filename}{pkgname} = $package;
+ #$Cache{$filename}{mtime} = $mtime;
+ $Cache{$__filename} = [ $__path, $__name, $__package, $__mtime ];
+ }
+ }
+
+ $0=$__filename;
+ @ARGV = ( $__name );
+ my $__QS = $ENV{'QUERY_STRING'};
+ if (( $__QS ne '')&&(index( $__QS, '=' ) == -1 ))
+ {
+ push( @ARGV, split( $__QS ) );
+ }
+ eval {$__package->handler;};
+
+ delete_package($__package) if $__delete;
+ return 0;
+ #take a look if you want
+ #print Devel::Symdump->rnew($package)->as_string, $/;
+}
+
+
+my $req = FCGI::Request();
+my $count = 0;
+my $ret;
+my $max_req = -1;
+if ( $ENV{'FCGI_PERL_MAX_REQ'} eq '' )
+{
+ $max_req = 500;
+}
+else
+{
+ $max_req = int($ENV{'FCGI_PERL_MAX_REQ'});
+}
+
+while($req->accept() >= 0)
+{
+ my $filename = $ENV{'SCRIPT_FILENAME'};
+
+ # Make it looks like ActiveState's PerlEx, otherwise CGI.pm won't reset
+ # request parameters
+ $ENV{'GATEWAY_INTERFACE'} = 'CGI-PerlEx/1.1';
+
+ if ( $filename ne '' )
+ {
+ $ret = execute_file( $filename, 0 );
+ ++$count;
+ if ( $ret )
+ {
+ if ( $ret == 404 )
+ {
+ print( "Status: 404\r\nContent-type: text/plain\r\n\r\n",
+ "ERROR: file not find: \'$filename\'!\n" );
+ }
+ elsif ( $ret == 500 )
+ {
+ print( "Status: 500\r\nContent-type: text/plain\r\n\r\n",
+ "ERROR: \'$filename\' is not a valid Perl script!\n" );
+ }
+ }
+ }
+ else
+ {
+ print( "Content-type: text/plain\r\n\r\n",
+ "ERROR: missing environment variable \'SCRIPT_FILENAME\'!\n" );
+ }
+
+ $req->Finish();
+ last if ( ( $max_req != 0 )&&( $count >= $max_req ) );
+}
+
diff --git a/install/lscp/fcgi-bin/lsphp b/install/lscp/fcgi-bin/lsphp
new file mode 100755
index 000000000..7353b60d5
Binary files /dev/null and b/install/lscp/fcgi-bin/lsphp differ
diff --git a/install/lscp/logs/access.log b/install/lscp/logs/access.log
new file mode 100644
index 000000000..e69de29bb
diff --git a/install/lscp/logs/error.log b/install/lscp/logs/error.log
new file mode 100644
index 000000000..9bb457b6d
--- /dev/null
+++ b/install/lscp/logs/error.log
@@ -0,0 +1,10 @@
+2018-09-18 06:38:39.581642 [NOTICE] Loading LiteSpeed/0.1.0 Open ...
+2018-09-18 06:38:39.581657 [NOTICE] Using [OpenSSL 1.1.0i 14 Aug 2018]
+2018-09-18 06:38:39.585545 [NOTICE] [AutoRestarter] new child process with pid=12238 is forked!
+2018-09-18 06:38:39.589894 [NOTICE] [child: 12238] Successfully change current user to lscpd
+2018-09-18 06:38:39.589931 [NOTICE] Child: 12238] Core dump is disabled.
+2018-09-18 06:38:39.589989 [NOTICE] [Child: 12238] Setup swapping space...
+2018-09-18 06:38:39.590167 [NOTICE] [Child: 12238] LiteSpeed/0.1.0 Open starts successfully!
+2018-09-18 06:38:40.000485 [NOTICE] [PID: 12236]: forked cgid: 12241
+2018-09-18 06:39:39.062994 [INFO] checkStatusFile() called with uid 994 randoffset -1.
+2018-09-18 06:39:39.063978 [INFO] checkStatusFile() return 0.
diff --git a/install/lscp/logs/error.log.2018_09_18 b/install/lscp/logs/error.log.2018_09_18
new file mode 100644
index 000000000..e684ec7f1
--- /dev/null
+++ b/install/lscp/logs/error.log.2018_09_18
@@ -0,0 +1,2 @@
+2018-09-18 06:38:39.581194 [WARN] Can not listen on address[/tmp/lscpd/cgid/cgid.sock.*]: No such file or directory, please clean up manually!
+2018-09-18 06:38:39.581328 [ERROR] Cannot create a valid unix domain socket for CGI daemon.
diff --git a/install/lscp/logs/lsrestart.log b/install/lscp/logs/lsrestart.log
new file mode 100644
index 000000000..aa903f8b9
--- /dev/null
+++ b/install/lscp/logs/lsrestart.log
@@ -0,0 +1,2 @@
+Tue Sep 18 06:38:39 UTC 2018
+start, LSWS running: 0
diff --git a/install/lscp/logs/stderr.log b/install/lscp/logs/stderr.log
new file mode 100644
index 000000000..e69de29bb
diff --git a/install/lscp/modules/cache.so b/install/lscp/modules/cache.so
new file mode 100755
index 000000000..d960c9e9f
Binary files /dev/null and b/install/lscp/modules/cache.so differ
diff --git a/install/lscp/modules/modinspector.so b/install/lscp/modules/modinspector.so
new file mode 100755
index 000000000..1afe8810f
Binary files /dev/null and b/install/lscp/modules/modinspector.so differ
diff --git a/install/lscp/modules/modreqparser.so b/install/lscp/modules/modreqparser.so
new file mode 100755
index 000000000..937fb78d2
Binary files /dev/null and b/install/lscp/modules/modreqparser.so differ
diff --git a/install/lscp/modules/uploadprogress.so b/install/lscp/modules/uploadprogress.so
new file mode 100755
index 000000000..d7d855469
Binary files /dev/null and b/install/lscp/modules/uploadprogress.so differ
diff --git a/install/lscp/share/autoindex/bwlimit.html b/install/lscp/share/autoindex/bwlimit.html
new file mode 100644
index 000000000..965f42909
--- /dev/null
+++ b/install/lscp/share/autoindex/bwlimit.html
@@ -0,0 +1,128 @@
+
+509 Bandwidth Limit Exceeded
+
+Bandwidth Limit Exceeded
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+The server is temporarily unable to service your request due to the site owner reaching his/her bandwidth limit. Please try again later.
+
+
+
diff --git a/install/lscp/share/autoindex/default.php b/install/lscp/share/autoindex/default.php
new file mode 100644
index 000000000..d28142a37
--- /dev/null
+++ b/install/lscp/share/autoindex/default.php
@@ -0,0 +1,434 @@
+nameFormat = '%-' . ($this->nameWidth + 4) . '.' . ($this->nameWidth + 4) .'s';
+ }
+}
+
+class IMG_Mapping
+{
+ var $suffixes;
+ var $imageName;
+ var $desc;
+ var $alt;
+ function IMG_Mapping( $arrSuffix, $imgName, $altName, $descr )
+ {
+ $this->suffixes = $arrSuffix;
+ $this->imageName = $imgName;
+ $this->alt = $altName;
+ $this->desc = $descr;
+ }
+ function found($ext)
+ {
+ return in_array($ext, $this->suffixes);
+ }
+}
+
+class AllImgs
+{
+ var $mapping, $default_img, $dir_img;
+
+ function AllImgs()
+ {
+ $this->mapping = array(
+ new IMG_Mapping( array( 'gif', 'png', 'jpg', 'jpeg', 'tif', 'tiff', 'bmp', 'svg', 'raw'),
+ 'image.png', '[IMG]', '' ),
+ new IMG_Mapping( array( 'html', 'htm', 'shtml', 'php', 'phtml',
+ 'css', 'js' ),
+ 'html.png', '[HTM]', '' ),
+ new IMG_Mapping( array( 'txt', 'md5', 'c', 'cpp', 'cc', 'h', 'sh' ),
+ 'text.png', '[TXT]', '' ),
+ new IMG_Mapping( array( 'gz', 'tgz', 'zip', 'Z', 'z'),
+ 'compress.png', '[CMP]', '' ),
+ new IMG_Mapping( array( 'bin', 'exe' ),
+ 'binary.png','[BIN]', '' ),
+ new IMG_Mapping( array( 'mpg', 'avi', 'mpeg', 'ram', 'wmv' ),
+ 'movie.png','[VID]', '' ),
+ new IMG_Mapping( array( 'mp3', 'mp2', 'ogg', 'wav', 'wma',
+ 'aac', 'mp4', 'rm'),
+ 'sound.png', '[SND]', '' )
+
+ );
+
+ $this->default_img = new IMG_Mapping( NULL, 'unknown.png', 'unknown', '' );
+ $this->dir_img = new IMG_Mapping( NULL, 'folder.png', 'directory', '' );
+ $this->parent_img = new IMG_Mapping( NULL, 'up.png', 'up', '' );
+ }
+
+ function findImgMapping($file)
+ {
+ $found = NULL;
+ $pos = strrpos( $file, '.' );
+ if ( $pos !== FALSE )
+ {
+ $ext = substr($file, $pos+1);
+ if ( $ext !== FALSE )
+ {
+ $l = count($this->mapping);
+ for ( $i = 0 ; $i < $l ; ++$i )
+ {
+ if ( in_array($ext, $this->mapping[$i]->suffixes) )
+ {
+ $found = $this->mapping[$i];
+ break;
+ }
+ }
+ }
+ }
+ if ( !isset($found) )
+ $found = $this->default_img;
+ return $found;
+ }
+}
+
+// END of customization section
+
+
+
+class FileStat
+{
+ var $name;
+ var $size;
+ var $mtime;
+ var $isdir;
+ var $img;
+
+ function FileStat($filename)
+ {
+ $this->name = $filename;
+ }
+}
+
+function shouldExclude( $file, &$excludes )
+{
+ $ex = reset( $excludes );
+ foreach( $excludes as $ex )
+ {
+ if ( fnmatch( $ex, $file ) )
+ return true;
+ }
+ return false;
+}
+
+function readDirList( $path, &$excludes, &$map )
+{
+ $handle = opendir( $path );
+ if ( $handle === false )
+ {
+ return null;
+ }
+ clearstatcache();
+ $list = array();
+ if ( isset( $_SERVER['LS_AI_INDEX_IGNORE'] ) )
+ {
+ $ignore = explode( ' ', $_SERVER['LS_AI_INDEX_IGNORE'] );
+ $excludes = array_merge( $ignore, $excludes );
+ }
+ while( false !== ($file=readdir($handle)) )
+ {
+ if ( shouldExclude( $file, $excludes ) )
+ continue;
+ $fileStat = new FileStat($file);
+ $s = stat("$path$file");
+ $fileStat->mtime = $s[9];
+ $fileStat->isdir = ($s[2] & 040000)? '/':'';
+
+ // get image mapping
+ if ( $fileStat->isdir )
+ {
+ $fileStat->size = -1;
+ $fileStat->img = $map->dir_img;
+ }
+ else
+ {
+ if ( $s[12] > 0 )
+ $fileStat->size = 512*$s[12];
+ else
+ $fileStat->size = $s[7];
+ $fileStat->img = $map->findImgMapping($file);
+ }
+
+ $list[] = $fileStat;
+ }
+ closedir( $handle );
+ return $list;
+}
+
+function printOneEntry( $base, $name, $fileStat, $setting )
+{
+ $encoded = str_replace(array('%2F', '%26amp%3B'), array('/', '%26'),
+ rawurlencode( $base . $fileStat->name ));
+ if ( isset($_SERVER['LS_FI_OFF'])&& $_SERVER['LS_FI_OFF'] )
+ {
+ $buf = '' . '' . sprintf( $setting->nameFormat, $name."\n");
+ }
+ else
+ {
+ $buf = '
';
+ if ( strlen( $name ) > $setting->nameWidth )
+ {
+ $name = substr( $name, 0, $setting->nameWidth - 3 ). '...';
+ }
+ $buf .= sprintf( $setting->nameFormat, $name."");
+ if ( $fileStat->mtime != -1 )
+ $buf .= date($setting->Time_Format, $fileStat->mtime);
+ else
+ $buf .= ' ';
+ if ( $fileStat->size != -1 )
+ $buf .= sprintf( "%7ldk ", ( $fileStat->size + 1023 ) / 1024);
+ else
+ $buf .= ' - ';
+ $buf .= ' ' . $fileStat->img->desc;
+ $buf .= "\n";
+ }
+ echo $buf;
+
+}
+
+function printIncludes( $path, $name )
+{
+ $testNames = array( "$name.html", "$name.htm", $name );
+ foreach ( $testNames as $n )
+ {
+ $filename = $path . $n;
+
+ if ( file_exists($filename) )
+ {
+ $content = file_get_contents($filename);
+ if ( $n == $name )
+ {
+ echo "\n";
+ echo $content;
+ echo "
\n";
+ }
+ else
+ echo $content;
+ break;
+ }
+ }
+}
+
+function printFileList( $list, $base_uri, $setting )
+{
+ foreach( $list as $fileStat )
+ {
+ if ( $fileStat->isdir )
+ {
+ printOneEntry( $base_uri, $fileStat->name, $fileStat, $setting );
+ }
+ }
+
+ foreach( $list as $fileStat )
+ {
+ if ( !$fileStat->isdir )
+ {
+ printOneEntry( $base_uri, $fileStat->name, $fileStat, $setting );
+ }
+ }
+
+}
+
+
+function cmpNA( $a, $b )
+{
+ return strcmp( $a->name, $b->name );
+}
+
+function cmpND( $a, $b )
+{
+ return -cmpNA( $a, $b );
+}
+
+function cmpSA( $a, $b )
+{
+ $ret = $a->size - $b->size;
+ if ( $ret )
+ return $ret;
+ return cmpNA( $a, $b );
+}
+
+function cmpSD( $a, $b )
+{
+ return -cmpSA( $a, $b );
+}
+
+function cmpMA( $a, $b )
+{
+ return $a->mtime - $b->mtime;
+
+}
+
+function cmpMD( $a, $b )
+{
+ return -cmpMA( $a, $b );
+}
+
+function cmpDA( $a, $b )
+{
+ $ret = strcmp( $a->img->desc, $b->img->desc );
+ if ( $ret )
+ return $ret;
+ return strcmp( $a->name, $b->name );
+}
+
+function cmpDD( $a, $b )
+{
+ return -cmpDA( $a, $b );
+}
+
+
+
+
+//phpinfo();
+$pos = strpos( $_SERVER['REQUEST_URI'], '?' );
+if ( $pos === FALSE )
+{
+ $uri = $_SERVER['REQUEST_URI'];
+}
+else
+{
+ $uri = substr( $_SERVER['REQUEST_URI'], 0, $pos );
+}
+
+$uri = urldecode( $uri );
+$path = $_SERVER['LS_AI_PATH'];
+
+$mime_type = $_SERVER['LS_AI_MIME_TYPE'];
+if ( $mime_type )
+ header( "Content-Type: $mime_type" );
+
+if ( !$path )
+{
+ echo "[ERROR] Auto Index script can not be accessed directly!";
+ return ;
+}
+
+
+if (get_magic_quotes_gpc())
+{
+ $uri = stripslashes( $uri );
+ $path = stripslashes( $path );
+}
+
+$uri = htmlentities($uri,ENT_COMPAT,"UTF-8");
+
+$setting = new UserSettings();
+$map = new AllImgs();
+$sortOrder = $_SERVER['QUERY_STRING'];
+if ( $sortOrder == ''
+ || strlen($sortOrder) > 2
+ || ! in_array($sortOrder, array('NA','ND','MA','MD','SA','SD','DA','DD'))) {
+ $sortOrder = 'NA'; // set to default
+}
+
+$NameSort = ($sortOrder == 'NA') ? 'ND' : 'NA';
+$ModSort = ($sortOrder == 'MA') ? 'MD' : 'MA';
+$SizeSort = ($sortOrder == 'SA') ? 'SD' : 'SA';
+$DescSort = ($sortOrder == 'DA') ? 'DD' : 'DA';
+
+if ( !$path )
+{
+ header("HTTP/1.1 403 Forbidden" );
+ echo "403 Access Denied
";
+ exit;
+}
+else
+{
+ $list = readDirList( $path, $setting->Exclude_Patterns, $map );
+ if ( $list === null )
+ {
+ header("HTTP/1.1 403 Forbidden" );
+ echo "403 Access Denied
";
+ exit;
+ }
+}
+
+
+echo "
+
+
+
+ Index of ", $uri, "
+
+ Index of ", $uri, "
";
+
+if ( isset($setting->HeaderName) )
+ printIncludes( $path, $setting->HeaderName );
+
+if ( isset($_SERVER['LS_FI_OFF'])&& $_SERVER['LS_FI_OFF'] )
+{
+ $header = "\n";
+}
+else
+{
+ $header = "
IconPath/blank.png\" alt=\" \"> ";
+ $header .= sprintf( $setting->nameFormat, 'Name' );
+ $header .= " Last modified Size Description \n
";
+}
+echo $header;
+
+if ( $uri != '/' )
+{
+ $fileStat = new FileStat('');
+ $fileStat->mtime = filemtime($path);
+ $fileStat->img = $map->parent_img;
+ $fileStat->size = -1;
+ $base = substr( $uri, 0, strlen( $uri ) - 1 );
+ $off = strrpos( $base, '/' );
+ if ( $off !== FALSE )
+ {
+ $base = substr( $base, 0, $off + 1 );
+ printOneEntry( $base, "Parent Directory", $fileStat, $setting );
+ }
+
+}
+$cmpFunc = "cmp$sortOrder";
+usort( $list, $cmpFunc );
+printFileList( $list, $uri, $setting );
+
+if ( isset($_SERVER['LS_FI_OFF'])&& $_SERVER['LS_FI_OFF'] )
+{
+ echo "\n";
+}
+else
+{
+ echo "
";
+}
+
+if ( isset($setting->ReadmeName) ) {
+ printIncludes( $path, $setting->ReadmeName );
+}
+
+echo "Proudly Served by LiteSpeed Web Server at ".$_SERVER['SERVER_NAME']." Port ".$_SERVER['SERVER_PORT']."
+
+";
diff --git a/install/lscp/share/autoindex/icons/binary.png b/install/lscp/share/autoindex/icons/binary.png
new file mode 100644
index 000000000..ff27e84de
Binary files /dev/null and b/install/lscp/share/autoindex/icons/binary.png differ
diff --git a/install/lscp/share/autoindex/icons/blank.png b/install/lscp/share/autoindex/icons/blank.png
new file mode 100644
index 000000000..a91d98a98
Binary files /dev/null and b/install/lscp/share/autoindex/icons/blank.png differ
diff --git a/install/lscp/share/autoindex/icons/compress.png b/install/lscp/share/autoindex/icons/compress.png
new file mode 100644
index 000000000..59e7e90c7
Binary files /dev/null and b/install/lscp/share/autoindex/icons/compress.png differ
diff --git a/install/lscp/share/autoindex/icons/folder.png b/install/lscp/share/autoindex/icons/folder.png
new file mode 100644
index 000000000..68f7e8688
Binary files /dev/null and b/install/lscp/share/autoindex/icons/folder.png differ
diff --git a/install/lscp/share/autoindex/icons/html.png b/install/lscp/share/autoindex/icons/html.png
new file mode 100644
index 000000000..bead1092d
Binary files /dev/null and b/install/lscp/share/autoindex/icons/html.png differ
diff --git a/install/lscp/share/autoindex/icons/image.png b/install/lscp/share/autoindex/icons/image.png
new file mode 100644
index 000000000..b6b09ed41
Binary files /dev/null and b/install/lscp/share/autoindex/icons/image.png differ
diff --git a/install/lscp/share/autoindex/icons/movie.png b/install/lscp/share/autoindex/icons/movie.png
new file mode 100644
index 000000000..80f18a9e0
Binary files /dev/null and b/install/lscp/share/autoindex/icons/movie.png differ
diff --git a/install/lscp/share/autoindex/icons/sound.png b/install/lscp/share/autoindex/icons/sound.png
new file mode 100644
index 000000000..ca40f3e71
Binary files /dev/null and b/install/lscp/share/autoindex/icons/sound.png differ
diff --git a/install/lscp/share/autoindex/icons/text.png b/install/lscp/share/autoindex/icons/text.png
new file mode 100644
index 000000000..c6f59b5c6
Binary files /dev/null and b/install/lscp/share/autoindex/icons/text.png differ
diff --git a/install/lscp/share/autoindex/icons/unknown.png b/install/lscp/share/autoindex/icons/unknown.png
new file mode 100644
index 000000000..89e42e000
Binary files /dev/null and b/install/lscp/share/autoindex/icons/unknown.png differ
diff --git a/install/lscp/share/autoindex/icons/up.png b/install/lscp/share/autoindex/icons/up.png
new file mode 100644
index 000000000..4a2e23f48
Binary files /dev/null and b/install/lscp/share/autoindex/icons/up.png differ
diff --git a/plogical/website.py b/plogical/website.py
index e882dbb8a..5823dbe5b 100644
--- a/plogical/website.py
+++ b/plogical/website.py
@@ -144,7 +144,7 @@ class WebsiteManager:
if ACLManager.currentContextPermission(currentACL, 'createWebsite') == 0:
return ACLManager.loadErrorJson('createWebSiteStatus', 0)
- domain = data['domainName']
+ domain = data['domainName'].lstrip('http://').lstrip('https://').rstrip('/')
adminEmail = data['adminEmail']
phpSelection = data['phpSelection']
packageName = data['package']
@@ -159,7 +159,7 @@ class WebsiteManager:
## Create Configurations
- execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
+ execPath = "sudo /usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
execPath = execPath + " createVirtualHost --virtualHostName " + domain + \
" --administratorEmail " + adminEmail + " --phpVersion '" + phpSelection + \
"' --virtualHostUser " + externalApp + " --ssl " + str(data['ssl']) + " --dkimCheck " \
@@ -186,7 +186,7 @@ class WebsiteManager:
admin = Administrator.objects.get(pk=userID)
masterDomain = data['masterDomain']
- domain = data['domainName']
+ domain = data['domainName'].lstrip('http://').lstrip('https://').rstrip('/')
phpSelection = data['phpSelection']
path = data['path']
tempStatusPath = "/home/cyberpanel/" + str(randint(1000, 9999))
diff --git a/static/websiteFunctions/websiteFunctions.js b/static/websiteFunctions/websiteFunctions.js
index e61bd4640..fbf022336 100644
--- a/static/websiteFunctions/websiteFunctions.js
+++ b/static/websiteFunctions/websiteFunctions.js
@@ -2389,6 +2389,38 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
}
+ // REWRITE Template
+
+ const httpToHTTPS = `### Rewrite Rules Added by CyberPanel Rewrite Rule Generator
+
+RewriteEngine On
+RewriteCond %{HTTPS} !=on
+RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
+
+### End CyberPanel Generated Rules.
+
+`;
+
+ const nonWWWToWWW = `### Rewrite Rules Added by CyberPanel Rewrite Rule Generator
+
+RewriteEngine On
+RewriteCond %{HTTP_HOST} !^www\. [NC]
+RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
+
+### End CyberPanel Generated Rules.
+
+`;
+
+ $scope.applyRewriteTemplate = function () {
+
+ if($scope.rewriteTemplate === "Force HTTP -> HTTPS"){
+ $scope.rewriteRules = httpToHTTPS + $scope.rewriteRules;
+ }else if($scope.rewriteTemplate === "Force NON-WWW -> WWW"){
+ $scope.rewriteRules = nonWWWToWWW + $scope.rewriteRules;
+ }
+ };
+
+
});
/* Java script code to create account ends here */
diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js
index e61bd4640..fbf022336 100644
--- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js
+++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js
@@ -2389,6 +2389,38 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
}
+ // REWRITE Template
+
+ const httpToHTTPS = `### Rewrite Rules Added by CyberPanel Rewrite Rule Generator
+
+RewriteEngine On
+RewriteCond %{HTTPS} !=on
+RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
+
+### End CyberPanel Generated Rules.
+
+`;
+
+ const nonWWWToWWW = `### Rewrite Rules Added by CyberPanel Rewrite Rule Generator
+
+RewriteEngine On
+RewriteCond %{HTTP_HOST} !^www\. [NC]
+RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
+
+### End CyberPanel Generated Rules.
+
+`;
+
+ $scope.applyRewriteTemplate = function () {
+
+ if($scope.rewriteTemplate === "Force HTTP -> HTTPS"){
+ $scope.rewriteRules = httpToHTTPS + $scope.rewriteRules;
+ }else if($scope.rewriteTemplate === "Force NON-WWW -> WWW"){
+ $scope.rewriteRules = nonWWWToWWW + $scope.rewriteRules;
+ }
+ };
+
+
});
/* Java script code to create account ends here */
diff --git a/websiteFunctions/templates/websiteFunctions/website.html b/websiteFunctions/templates/websiteFunctions/website.html
index addddb5fc..431f6695b 100644
--- a/websiteFunctions/templates/websiteFunctions/website.html
+++ b/websiteFunctions/templates/websiteFunctions/website.html
@@ -443,7 +443,7 @@
@@ -659,13 +659,29 @@
+
{% trans "Could not fetch current rewrite rules. Error message:" %} {$
errorMessage $}
@@ -697,7 +713,7 @@
@@ -893,7 +909,7 @@
-
+
@@ -902,16 +918,17 @@
-
+
-
+
@@ -920,9 +937,10 @@
-