UPGRADING BLUEHOST FROM SHARED TO PRO HOSTING AND SSL - Jun 10th, 2018


Things learned when upgrading from shared hosting to pro hosting with a dedicated IP address and implementing SSL
certificates on Bluehost.

In the original setup on shared hosting all site files for both example.com and example.org were in a sub-directory
called 'example' in the 'public_html' folder and the .htaccess file in the 'example' sub-directory redirected the
domains to point to the appropriate index file.

The original code for the .htaccess file in the 'example' sub-directory was:

# Use PHP5.4 Single php.ini as default

AddHandler application/x-httpd-php54s .php

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(www.)?example.com$

RewriteCond %{REQUEST_URI} !^/example/

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /example/$1

RewriteCond %{HTTP_HOST} ^(www.)?example.com$

RewriteRule ^(/)?$ example/index.php [L]


RewriteEngine on

RewriteCond %{HTTP_HOST} ^(www.)?example.org$

RewriteCond %{REQUEST_URI} !^/example/

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /example/$1

RewriteCond %{HTTP_HOST} ^(www.)?example.org$

RewriteRule ^(/)?$ example/index.php [L]

Here are the changes that were required after upgrading to pro hosting and SSL certificates:

1) I needed to re-assign database permissions to users, since they were wiped during transfer to pro hosting.

Since I still wanted both .com and .org to point to the same 'example' sub-directory,

1) my client needed to obtain 2 SSL certificates.

2) 2 separate, and different, .htaccess files were required. One in the 'public_html' directory and one in the 'example'
sub-directory.

In the 'public_html' .htaccess file, I added the following code to turn on the HTTPS requirement (don’t know if it was
actually necessary, but it seemed to make things work, and doesn’t seem to break anything):

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

In addition, since the .htaccess file in the 'public_html' directory now only redirects the .com (primary domain) to the
'example' sub-directory, the entire code block for the .org was commented out.

# Use PHP5.4 Single php.ini as default

AddHandler application/x-httpd-php54s .php

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(www.)?example.com$

RewriteCond %{REQUEST_URI} !^/example/

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /example/$1

RewriteCond %{HTTP_HOST} ^(www.)?example.com$

RewriteRule ^(/)?$ example/index.php [L]

#RewriteEngine on

#RewriteCond %{HTTP_HOST} ^(www.)?example.org$

#RewriteCond %{REQUEST_URI} !^/example/

#RewriteCond %{REQUEST_FILENAME} !-f

#RewriteCond %{REQUEST_FILENAME} !-d

#RewriteRule ^(.*)$ /example/$1

#RewriteCond %{HTTP_HOST} ^(www.)?example.org$

#RewriteRule ^(/)?$ example/index.php [L]

The .htaccess file in the 'example' sub-directory redirected both .com and .org to the appropriate index file. (Note the
line that was commented out (#) of the original shared hosting .htaccess file code)

# Use PHP5.4 Single php.ini as default
AddHandler application/x-httpd-php54s .php

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/example/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule ^(.*)$ /example/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ example/index.php [L]

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.org$
RewriteCond %{REQUEST_URI} !^/example/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule ^(.*)$ /example/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.org$
RewriteRule ^(/)?$ example/index.php [L]




The materials on this web site have been created for use with CMS Builder content management software. CMS Builder software is published and licensed for use by InteractiveTools.com. Please contact Interactive Tools for information on the downloading of the software or the purchasing of licenses.


Terms of Service