Need to redirexct from https to http

New to mod_rewrite? This is a good place to start.

Need to redirexct from https to http

Postby jeremybass » Fri Aug 28, 2009 12:22 pm

Hello I need to redirect from https to http...

https://www.sjrmc.org/

to

http://www.sjrmc.org/


This is what I've tried...

(these just do nothing... )
Code: Select all
RewriteEngine On
RewriteCond  %{SERVER_PORT} !^80$
RewriteRule ^(.*)$ http://www.sjrmc.org/$1 [L,R]


Code: Select all
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^sjrmc\.org
RewriteRule ^(.*)$ http://www.sjrmc.org/$1 [R=301,L]
</IfModule>


Code: Select all
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]


Code: Select all
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.sjrmc.org/$1 [R=301,L]





(these got me a 404)
Code: Select all
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R]







this is what I have

Code: Select all
# BEGIN Optional settings
Options -Indexes

# Deny access to config.php
<Files "config.php">
order allow,deny
deny from all
</Files>

# No sense advertising what we are running
ServerSignature Off

# END Optional Settings

# BEGIN CMSMS and Rewrite Rules
# Make sure you have Options FollowSymLinks
# and Allow on

RewriteEngine On

# Might be needed in a subdirectory
#RewriteBase /
# URL Filtering helps stop some hack attempts
#IF the URI contains a "http:"
RewriteCond %{QUERY_STRING} http\: [OR]

#OR if the URI contains a "["
RewriteCond %{QUERY_STRING} \[ [OR]

#OR if the URI contains a "]"
RewriteCond %{QUERY_STRING} \] [OR]

#OR if the URI contains a "<script>"
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]

#OR script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]

#OR any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) [OR]

#IF the URI contains UNION
RewriteCond %{QUERY_STRING} UNION [OR]

#OR if the URI contains a *
RewriteCond %{QUERY_STRING} \*

#then deny the request (403)
RewriteRule ^.*$ - [F,L]

# End URL Filtering

RewriteCond %{SERVER_PORT} ^443$
RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]


# force CMSMS www IN URL
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
# END CMSMS force www IN URL




# CMSMS Rewriting
# Set assume mod_rewrite to true in config.php and clear CMSMS cache
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]

# CMSMS Header Expires
# 3months
#<FilesMatch "\.(ico|gif|jpg|jpeg|png|flv|pdf|mp3|wav)$">
#  Header set Cache-Control "max-age=7257600"
#  Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT"
#  Header unset Last-Modified
#</FilesMatch>
# WEEK
#<FilesMatch "\.(js|css|swf|gz)$">
#  Header set Cache-Control "max-age=604800"
#</FilesMatch>
# 45 MIN
#<FilesMatch "\.(html|htm|txt)$">
#  Header set Cache-Control "max-age=2700"
#</FilesMatch>

<FilesMatch "\.(ico|gif|jpg|jpeg|png|flv|pdf|mp3|wav)$">
Header unset Last-Modified
Header set Expires "Fri, 21 Dec 2012 00:00:00 GMT"
Header set Cache-Control "public, no-transform"
Header set Cache-Control "max-age=7257600"
</FilesMatch>

# CMSMS Safari gzip fix
# AddEncoding gzip .gz
# RewriteCond %{HTTP:Accept-encoding} gzip
# RewriteCond %{HTTP_USER_AGENT} !Safari|!playstation\ 3 [NC]
# RewriteCond %{REQUEST_FILENAME}.gz -f
# RewriteRule ^(.*)$ $1.gz [QSA,L]



# CMSMS unset ETag
Header unset ETag
FileETag None
#<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|gz|swf|mp3|wav)$">
#Header unset ETag
#FileETag None
#</FilesMatch>

# CMSMS block unwanted HTTP_REFERER
# RewriteCond %{HTTP_REFERER} !^$
# RewriteCond %{HTTP_REFERER} !^https://(www\.)?sjrmc.org/.*$ [NC]
# RewriteRule \.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$ /feed/ [R=302,L]



# END CMSMS



thanks for the help... Cheers
Jeremy
jeremybass
 
Posts: 9
Joined: Thu Jun 05, 2008 9:59 am

Postby richardk » Sat Aug 29, 2009 2:36 pm

Did you fix it?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: Google [Bot] and 26 guests

cron