Solved

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

Posted on 2014-09-20
7
316 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 14

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
Backup Your Microsoft Windows Server®

Backup 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 14

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
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.

863 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now