> ## Content Index
> Fetch the complete content index at: https://helpmonks.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Redirecting all users to https with apache and without .htaccess
- URL: https://helpmonks.com/blog/redirecting-users-https-apache-without-htaccess/
- Published: 2014-05-02T00:00:00.000Z
- Updated: 2026-04-03T02:00:25.000Z
- Description: This is more a note to myself, but while enabling a certificate on one server I came upon this little snippet to redirect all http access to the secure https
- Author: Nitai
- Tags: email marketing

This is more a note to myself, but while enabling a certificate on one server I came upon this little snippet to redirect all http access to the secure https:

\[code\]RewriteEngine On  
\# This will enable the Rewrite capabilities

RewriteCond %{HTTPS} !=on  
\# This checks to make sure the connection is not already HTTPS

RewriteRule ^/?(.\*) https://%{SERVER\_NAME}/$1 \[R,L\]  
\# This rule will redirect users from their original location, to the same location but using HTTPS.  
\# i.e. http://www.example.com/foo/ to https://www.example.com/foo/  
\# The leading slash is made optional so that this will work either in httpd.conf  
\# or .htaccess context\[/code\]

I added this to each virtual host entry.