gold123456

Registered
Jun 12, 2018
1
0
1
london
cPanel Access Level
Root Administrator
Dear all,

I am a developer and have an account set up on cPanel.

I have 2 environments, a demo subdomain, and the main domain for production.

So example; demo.example.com -> /home/demo/ (outside public_html)
and movies.com -> public_html

I have the following htaccess file:

Code:
RewriteEngine on

<IfModule mod_rewrite.c>
    RewriteEngine on
    # let the PHP knows that the mod_rewrite module is ENABLED.
    RewriteCond %{HTTPS} off
    RewriteRule (.*) [URL]https://%[/URL]{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
The purpose of this thread is to seek help. I want to be able to redirect all http requests to https.

On the same server their is another account which handles rewriting URLs. This makes me believe mod_rewrite is working as expected.

Can someone help me please? I want to be able to redirect:

Code:
http://demo.example.com
to
Code:
https://demo.example.com
Code:
http://movies.com
to
Code:
https://example.com
or
Code:
https://www.example.com
 
Last edited by a moderator:

24x7server

Well-Known Member
Apr 17, 2013
1,912
99
78
India
cPanel Access Level
Root Administrator
Twitter
Hi,

The code you gave may work as expected, but the thing is there are lot of such codes available and it differs slightly from CMS to CMS, like for wordpress some of these codes work and the same does not work as expected for Joomla site. You will have to check what best suits your website requirement. You can also use some plugins for your CMS if you are using one and then check..