Solved

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

Posted on 2014-09-20
7
321 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 15

Accepted Solution

by:
Edwin Hoffer earned 500 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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
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,…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
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

630 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