Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

new to apache....forward all traffic from http to https

Posted on 2014-09-20
7
Medium Priority
?
324 Views
Last Modified: 2014-09-23
hi
i have a rule in place that redirects all traffic from http to https and it kinda works when i hit my site mysite.com/mysite/ it redirects to https://mysite.com/mysite/ but it doesn't display the site but it displays this message "forbidden" " you don't have access to access /mysite/ on this server

this is the rule

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

am i supposed to change any permissions anywhere?

thanks for any help
0
Comment
Question by:eli2011
  • 4
  • 2
7 Comments
 
LVL 15

Accepted Solution

by:
Edwin Hoffer earned 2000 total points
ID: 40334966
Change the above .htaccess code to below one:

RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R=301,L] 

Open in new window


If it's still not working, let me know.

Thanks
Edwin
0
 

Author Comment

by:eli2011
ID: 40335802
still get the Forbidden and You don't have permission to access /mysite/ on this server message
0
 
LVL 13

Expert Comment

by:Sandy
ID: 40336416
is your selinux set to enforcing ?

#sestatus

if yes then

#setenforce 0

and see if this works.

TY/SA
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
LVL 15

Expert Comment

by:Edwin Hoffer
ID: 40336435
@eli2011

Can you please share your website in PM, so I can check the issue.

Thanks
Edwin
0
 

Author Comment

by:eli2011
ID: 40337097
selinux if
0
 

Author Comment

by:eli2011
ID: 40337100
selinux is off i mean
0
 

Author Comment

by:eli2011
ID: 40337104
not sure what you mean.  post the httpd.conf and ssl.conf files?
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses
Course of the Month7 days, 10 hours left to enroll

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question