Solved

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

Posted on 2014-09-20
7
317 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.:

777 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