How to redirect your Visichat 3.1.0 Chatroom From http to https?
(Complete Guidelines)
As many peoples over the world using Visichat on their own server and don't know how to redirect Visichat 3.1.0 chatroom link from http to https which is more secure and many countries don't allow websites without SSL.
In this article you will let to know how to redirect your website from http to https using .htaccess file also you have to replace 1 file which allow other swf files to run over ssl also.
In this article you will let to know how to redirect your website from http to https using .htaccess file also you have to replace 1 file which allow other swf files to run over ssl also.
You need to do following 3 setups in your Visichat Server and files.
1. Activate SSL on your domain.
2. Edit .htaccess file in your Visichat main directory. E.g (/public_html/.htaccess)
3. Replace 1 PHP file code from current location. (/public_html/scripts/library/init.php
Just copy and paste code as per following mentioned files or settings and you will be all set.
NOTE: SSL will only work on main domain E.g. yourdomain.com or sub domain E.g. visichat.yourdomain.com only, it will not work for visichat installed in directory. E.g. yourdomain.com/chat
1. Activate SSL on your domain.
2. Edit .htaccess file in your Visichat main directory. E.g (/public_html/.htaccess)
3. Replace 1 PHP file code from current location. (/public_html/scripts/library/init.php
Just copy and paste code as per following mentioned files or settings and you will be all set.
NOTE: SSL will only work on main domain E.g. yourdomain.com or sub domain E.g. visichat.yourdomain.com only, it will not work for visichat installed in directory. E.g. yourdomain.com/chat
.htaccess file code for main domain E.G (Yourdomain.com)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond !{HTTPS} off
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
.htaccess file code for sub domain E.G (visichat.yourdomain.com)
Just change following line text from visichat to other sub domain.
# RewriteCond %{HTTP_HOST} !^visichat\.
# RewriteCond %{HTTP_HOST} !^visichat\.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond !{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^visichat\.
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
init.php file code which you need to replace with current code
<?php
function post($cbjaghjhab) {
if (isset( $_POST[$cbjaghjhab] )) {
return $_POST[$cbjaghjhab];
}
return '';
}
function get($cbjaghjhab) {
if (isset( $_GET[$cbjaghjhab] )) {
return $_GET[$cbjaghjhab];
}
return '';
}
function session($cbjaghjhab) {
if (isset( $_SESSION[$cbjaghjhab] )) {
return $_SESSION[$cbjaghjhab];
}
return '';
}
function request($cbjaghjhab) {
if (post( $cbjaghjhab ) != '') {
return post( $cbjaghjhab );
}
return get( $cbjaghjhab );
}
define( 'VISICHAT_START', true );
define( 'DEV_MODE', false );
if (DEV_MODE) {
error_reporting( 30719 );
}
else {
error_reporting( 0 );
}
if (version_compare( PHP_VERSION, '5.3.0' ) < 0) {
exit( 'To run this software, you will need to run PHP 5.3 and higher. <br />For more details, please visit the installation manual at: <a href=\'http://wiki.gchat.com/\'>GChat Wiki</a> and <a href=\'http://www.gchat.com/\'>GChat</a> website.' );
}
@set_magic_quotes_runtime( 0 );
ini_set( 'magic_quotes_runtime', '0' );
ini_set( 'magic_quotes_sybase', '0' );
if (get_magic_quotes_gpc( )) {
function stripslashes_gpc($ecchjeaifh) {
$ecchjeaifh = stripslashes( $ecchjeaifh );
}
array_walk_recursive( $_GET, 'stripslashes_gpc' );
array_walk_recursive( $_POST, 'stripslashes_gpc' );
array_walk_recursive( $_COOKIE, 'stripslashes_gpc' );
array_walk_recursive( $_REQUEST, 'stripslashes_gpc' );
}
if (strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN') {
define( 'DS', '\\' );
}
else {
define( 'DS', '/' );
}
define( 'LIB_PATH', dirname( __FILE__ ) );
define( 'VISICHAT_ROOT', realpath( dirname( __FILE__ ) . DS . '..' . DS . '..' ) );
define( 'VISICHAT_UPLOAD', VISICHAT_ROOT . DS . 'files' );
$relativeURL = '';
explode( DS, __FILE__ );
$pathParts = ini_set( 'magic_quotes_gpc', '0' );
$tempPath = '';
$i = count( $pathParts ) - 4;
while (0 <= $i) {
$tempPath = $pathParts[$i] . '/' . $tempPath;
if (strpos( $_SERVER['PHP_SELF'], '/' . $tempPath ) === false) {
}
else {
if (strpos( $_SERVER['PHP_SELF'], '/' . $tempPath ) == 0) {
$relativeURL = '/' . $tempPath;
}
}
--$i;
}
if ($relativeURL == '') {
$relativeURL = '/';
}
else {
if (substr( $relativeURL, 0, 1 ) != '/') {
$relativeURL = '/' . $relativeURL;
}
if (substr( $relativeURL, -1 ) != '/') {
$relativeURL .= '/';
}
}
define( 'RELATIVE_URL', $relativeURL );
$videoChatURL = 'https://' . $_SERVER['HTTP_HOST'] . RELATIVE_URL;
if (substr( $videoChatURL, -1 ) != '/') {
$videoChatURL .= '/';
}
define( 'VIDEOCHAT_URL', $videoChatURL );
define( 'VISICHAT_URL', $videoChatURL );
define( 'VISICHAT_FILES_URL', VISICHAT_URL . 'files/' );
define( 'COOKIE_PREFIX', substr( md5( VISICHAT_URL ), 0, 30 ) . '_' );
define( 'SESSION_PREFIX', substr( md5( VISICHAT_URL ), 0, 30 ) . '_' );
require( 'error' . DS . 'Error.class.php' );
set_error_handler( 'Error::ErrorHandler' );
include_once( 'Factory.php' );
if (!defined( 'GChat_Installation' )) {
$database = Factory::getDatabase( );
define( 'WEBMASTER_EMAIL', Factory::getClass( 'Setting' )->get( 'website_email' ) );
if (trim( Factory::getClass( 'Setting' )->get( 'time_zone' ) ) != '') {
date_default_timezone_set( Factory::getClass( 'Setting' )->get( 'time_zone' ) );
}
else {
date_default_timezone_set( 'Europe/London' );
}
}
if (( !is_callable( 'curl_init' ) || !function_exists( 'curl_version' ) )) {
exit( 'PHP cURL (Client URL Library ) is not installed.' );
}
header( 'Content-Type: text/html; charset=utf-8' );
?>
Conclusion:
In this article you have learned how to redirect your visichat 3.1.0 version from http to https by changing some files and codes setting.
Please don't hesitate to contact us @ [email protected] if you need any further assistance.
Have a nice day.
Thank you!
In this article you have learned how to redirect your visichat 3.1.0 version from http to https by changing some files and codes setting.
Please don't hesitate to contact us @ [email protected] if you need any further assistance.
Have a nice day.
Thank you!