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

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
eli2011Asked:
Who is Participating?
 
Edwin HofferTechnical ExpertCommented:
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
 
eli2011Author Commented:
still get the Forbidden and You don't have permission to access /mysite/ on this server message
0
 
SandyCommented:
is your selinux set to enforcing ?

#sestatus

if yes then

#setenforce 0

and see if this works.

TY/SA
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Edwin HofferTechnical ExpertCommented:
@eli2011

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

Thanks
Edwin
0
 
eli2011Author Commented:
selinux if
0
 
eli2011Author Commented:
selinux is off i mean
0
 
eli2011Author Commented:
not sure what you mean.  post the httpd.conf and ssl.conf files?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.