http to https redirect, folder name on shared hosting is being added

Asked by:
HubFans / n/a Points
Time:
2017-12-03 4:31 am EST
Category:
Htaccess
Hits:
94
I can get the main domain name to redirect no problem. The problem is that when I type into a browser or click one of my website links online, it's adding in the folder name after the domain name and it's not working.

For example, I type in www.example.com and it works fine to go to https.

When I type in any browser, or click the link on the web, www.example.com/contact.htm for example the link goes to www.example.com/FOLDERNAME/contact.htm.

This folder name is becoming part of the URL when I type it in a browser. Is there something I should add below to make it so it targets a folder and doesn't just add it? Does this look correct? Thank you very much.

RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteCond %{HTTP_HOST} ^example\.com.* [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com.*
RewriteRule ^ https://example.com%{REQUEST_URI} [R=301,L]

To ask this user for more information, please first login.

To submit an answer, please login.

ANSWERS

0

arnelc
Staff
17,314 Points
2017-12-04 7:13 pm EST
Hello,

Thanks for the question about your redirect. It appears that you're trying to force your site to use the SSL certificate. If you are using a site that does not require configuration changes to use SSL then you can follow this tutorial on how to force a website to use SSL. The code is provided for you in the tutorial.

If you have any further questions or comments, please let us know.

Regards,
Arnel C.

To submit a comment on this answer, please first login.

Want to share this Question?

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!
Need More Help?

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.
}