Solved

.htaccess problem in https

Posted on 2008-10-16
10
211 Views
Last Modified: 2010-08-05
i have setup https on my website.  by using this code

RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://www.cvbroadcaster.com/$1 [R]

i want to redirect this page to not https .

https://www.cvbroadcaster.com/cv_database/cv_list.php 
to
http://www.cvbroadcaster.com/cv_database/cv_list.php 



i have also another page to not g oto https ..just http . so what will be its rule ?
0
Comment
Question by:jamie_2008
  • 5
  • 4
10 Comments
 
LVL 27

Expert Comment

by:caterham_www
ID: 22738988
> i have also another page to not g oto https ..just http . so what will be its rule ?
Add anoter condition to the first rule in order to prevent a redirect to https
RewriteEngine on
RewriteCond %{HTTPS} =off
# exclude /cv_database/cv_list.php
RewriteCond %{REQUEST_URI} !=/cv_database/cv_list.php
RewriteRule ^(.*)$ https://www.cvbroadcaster.com/$1 [R,L]
 
# https://www.cvbroadcaster.com/cv_database/cv_list.php --> http://www.cvbroadcaster.com/cv_database/cv_list.php 
RewriteCond %{HTTPS} =on
RewriteRule ^(cv_database/cv_list\.php)$ http://www.cvbroadcaster.com/$1 [R,L]

Open in new window

0
 

Author Comment

by:jamie_2008
ID: 22740803
@caterham_www:

what if i want to add 2 more url's to exclude ?

above is working fine for 1 url

thanks
0
 
LVL 27

Expert Comment

by:caterham_www
ID: 22744921
Just add more conditions like
RewriteCond %{HTTPS} =off
# exclude /cv_database/cv_list.php
RewriteCond %{REQUEST_URI} !=/cv_database/cv_list.php
RewriteCond %{REQUEST_URI} !=/other_url-path
RewriteCond %{REQUEST_URI} !=/an_other_one
RewriteRule ^(.*)$ https://www.cvbroadcaster.com/$1 [R,L]

Open in new window

0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 51

Expert Comment

by:ahoffmann
ID: 22745704
> i want to redirect this page to not https
RewriteCond %{HTTPS} =on
RewriteCond %{REQUEST_URI} !/cv_database/cv_list.php$
RewriteRule ^(.*)$ http://www.cvbroadcaster.com/$1 [R,L]
0
 

Author Comment

by:jamie_2008
ID: 22746554
i added in this way ..but not worked ..

it says ..redirect loop ..so it will not complete
RewriteEngine on
RewriteCond %{HTTPS} =off
# exclude /cv_database/cv_list.php
RewriteCond %{REQUEST_URI} !=/cv_database/cv_list.php
RewriteCond %{REQUEST_URI} !=/cv_database/free_cv_database.php
RewriteCond %{REQUEST_URI} !=/cv_distribution/cv_sending.php
RewriteRule ^(.*)$ https://www.cvbroadcaster.com/$1 [R,L]
 
# https://www.cvbroadcaster.com/cv_database/cv_list.php --> http://www.cvbroadcaster.com/cv_database/cv_list.php 
RewriteCond %{HTTPS} =on
RewriteRule ^(cv_database/cv_list\.php)$ http://www.cvbroadcaster.com/$1 [R,L]
RewriteRule ^(cv_database/free_cv_database\.php)$ http://www.cvbroadcaster.com/$1 [R]
RewriteRule ^(cv_distribution/cv_sending\.php)$ http://www.cvbroadcaster.com/$1 [R]

Open in new window

0
 

Author Comment

by:jamie_2008
ID: 22746570
this is my all .htaccess file ... please look at that
# -FrontPage-
 
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
RewriteEngine On
RewriteRule ^cv_broadcasting\.html$ /cv_broadcasting.php
 
RewriteEngine on
RewriteCond %{HTTPS} =off
# exclude /cv_database/cv_list.php
RewriteCond %{REQUEST_URI} !=/cv_database/cv_list.php
RewriteCond %{REQUEST_URI} !=/cv_database/free_cv_database.php
RewriteCond %{REQUEST_URI} !=/cv_distribution/cv_sending.php
RewriteRule ^(.*)$ https://www.cvbroadcaster.com/$1 [R,L]
 
# https://www.cvbroadcaster.com/cv_database/cv_list.php --> http://www.cvbroadcaster.com/cv_database/cv_list.php 
RewriteCond %{HTTPS} =on
RewriteRule ^(cv_database/cv_list\.php)$ http://www.cvbroadcaster.com/$1 [R,L]
#RewriteRule ^(cv_database/free_cv_database\.php)$ http://www.cvbroadcaster.com/$1 [R]
#RewriteRule ^(cv_distribution/cv_sending\.php)$ http://www.cvbroadcaster.com/$1 [R]
 
#RewriteCond %{SERVER_PORT} !^443$
 
#RewriteRule ^(.*)$ https://www.cvbroadcaster.com/$1 [R]
 
AddType x-mapp-php5 .php
 
 
ErrorDocument 400 error400.html
ErrorDocument 403 error403.html
ErrorDocument 404 error404.html
ErrorDocument 500 error500.html

Open in new window

0
 
LVL 27

Expert Comment

by:caterham_www
ID: 22747617
change the last one into
RewriteCond %{HTTPS} =on
RewriteRule ^(cv_database/cv_(list|database|sending)\.php)$ http://www.cvbroadcaster.com/$1 [R,L]

Open in new window

0
 

Author Comment

by:jamie_2008
ID: 22747765
i have 2 files in a cv_database folder and one in cv_distribution folder .


RewriteEngine on
RewriteCond %{HTTPS} =off
# exclude /cv_database/cv_list.php
RewriteCond %{REQUEST_URI} !=/cv_database/cv_list.php
RewriteCond %{REQUEST_URI} !=/cv_database/free_cv_database.php
RewriteCond %{REQUEST_URI} !=/cv_distribution/cv_sending.php
RewriteRule ^(.*)$ https://www.cvbroadcaster.com/$1 [R,L]
 
# https://www.cvbroadcaster.com/cv_database/cv_list.php --> http://www.cvbroadcaster.com/cv_database/cv_list.php 
RewriteCond %{HTTPS} =on
RewriteRule ^(cv_database/cv_list\.php)$ http://www.cvbroadcaster.com/$1 [R,L]
RewriteRule ^(cv_database/free_cv_database\.php)$ http://www.cvbroadcaster.com/$1 [R]
RewriteRule ^(cv_distribution/cv_sending\.php)$ http://www.cvbroadcaster.com/$1 [R]

Open in new window

0
 

Author Comment

by:jamie_2008
ID: 22747784
hey
      its working ....i made the change ..below is the code

but can  u tell me why following was not working ?

RewriteRule ^(cv_database/cv_list\.php)$ http://www.cvbroadcaster.com/$1 [R,L]
RewriteRule ^(cv_database/free_cv_database\.php)$ http://www.cvbroadcaster.com/$1 [R]
RewriteRule ^(cv_distribution/cv_sending\.php)$ http://www.cvbroadcaster.com/$1 [R]

RewriteRule ^(cv_(database|distribution)/cv_(list|database|sending)\.php)$ http://www.cvbroadcaster.com/$1 [R,L] 

Open in new window

0
 
LVL 27

Accepted Solution

by:
caterham_www earned 500 total points
ID: 22747785
ah, so
[....]
 
# https://www.cvbroadcaster.com/cv_database/cv_list.php --> http://www.cvbroadcaster.com/cv_database/cv_list.php 
RewriteCond %{HTTPS} =on
RewriteRule ^(cv_database/(free_cv_database|cv_list)\.php)$ http://www.cvbroadcaster.com/$1 [R,L]
RewriteCond %{HTTPS} =on
RewriteRule ^(cv_distribution/cv_sending\.php)$ http://www.cvbroadcaster.com/$1 [R]

Open in new window

0

Featured Post

Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iptables limit connection per ip correct way ? 2 251
SSL - Wildcard Enough?  Or, Need EV 14 71
SSL CERTIFIACTE, EXCHANGE 12 126
mod_rewrite # anchor problem. 6 43
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
​Being a Managed Services Provider (MSP) has presented you  with challenges in the past— and by meeting those challenges you’ve reaped the rewards of success.  In 2014, challenges and rewards remain; but as the Internet and business environment evol…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

685 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