homepage Welcome to WebmasterWorld Guest from 54.167.173.250
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Help redirecting bookmarked urls from HTTPS to HTTP
sr98bj2002




msg:4318393
 3:47 am on May 27, 2011 (gmt 0)

Hello, I have stumbled upon your site and have learned a lot looking at previous posts but I still having a problem. I have inherited a problem on an existing site that I did not create that used to redirect all pages to HTTPS via the .htaccess file in the public_html root of the website. I have attempted to fix the issue but cannot seem to stop the non-SSL pages from displaying with HTTPS when requested by either a bookmark or just by typing in the URL with the HTTPS in front. Here is the code I have so far including things Ive tried that are commented out. When I type the link with https://www.debnroo.com, the site does not redirect to http. If I type the site with www.debnroo.com, it works fine and displays wiht http. Can someone help me please, been struggling with this for over 4 days now:

RewriteEngine On
#RewriteBase /~debnroo

#RewriteCond %{HTTPS} on
RewriteCond %{SERVER_PORT} =443
RewriteCond %{HTTP_HOST} ^debnroo.com
#RewriteCond %{REQUEST_URI} !^.*Cart/.*$
#RewriteCond %{REQUEST_URI} !^.*Checkout/.*$
RewriteCond $1 !^(Cart|Checkout)
RewriteCond $1 !\.(gif|jpe?g|png|ico|css|js)$
#RewriteRule ^(.*)$ [debnroo.com...] [R=301,L]
RewriteRule ^(.*)$ [%{HTTP_HOST}...] [R=301,L]

#RewriteCond %{HTTPS} off
RewriteCond %{SERVER_PORT} !=443
RewriteCond %{HTTP_HOST} !^.*spicycart.com$
RewriteCond %{HTTP_HOST} !^.*weauction4you.com$
RewriteCond %{HTTP_HOST} !^.*tablesinbags.com$
RewriteCond %{SCRIPT_FILENAME} !(about|products).php$
#RewriteCond %{REQUEST_URI} ^.*Checkout/.*$
#RewriteCond %{REQUEST_URI} ^.*Cart/.*$
#RewriteCond %{REQUEST_URI} ^((viewcart|viewcheckout)\.php)$
RewriteCond $1 ^(Cart|Checkout)
#RewriteRule !^.*(jpg|png|gif|jpeg).*$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteRule !^.*(jpg|png|gif|jpeg).*$ https://%{HTTP_HOST}/$1 [R=301,L]

RewriteRule ^.*Cart/.*$ viewcart.php [QSA,L]

RewriteRule ^.*Checkout/.*$ viewcheckout.php [QSA,L]

 

jdMorgan




msg:4318858
 12:17 am on May 28, 2011 (gmt 0)

The first step (and the first thing you need to know) is that you'll need to flush (completely delete) your browser cache before testing, and again after making any change to your server-side code.

Otherwise, your browser will very likely show you a previously-cached local copy of the page, and no HTTP request will be sent to your server. Since this code is server-side, it won't get a chance to execute, and therefore, you'll see no 'fix-up' redirect...

Having tested with an empty cache, let us know what problems remain. The code could do with a bit of cleaning-up, but I don't want to go off-track.

Jim

sr98bj2002




msg:4319261
 8:26 am on May 29, 2011 (gmt 0)

Thank you jdmorgan for replying to my post. I have deleted my browser cache and typed in https://www.debnroo.com and still the webpage displays with the IE 8 error prompt asking if I want to display the secure content only. You mentioned that the code could use some cleaning, do you have any other suggestions for me?

g1smd




msg:4319264
 8:31 am on May 29, 2011 (gmt 0)

Every line of code has one to three changes that needs to be made.

I'll post later in the day when I have more time.

sr98bj2002




msg:4320156
 7:36 pm on May 31, 2011 (gmt 0)

Oh wow, every line has up to 3 issues... That is not good, can you elaborate please? I'm new to Apache and these redirect rules, not sure what all needs to change. Any help would be appreciated.

sr98bj2002




msg:4322372
 3:32 am on Jun 6, 2011 (gmt 0)

I still need help with this issue, I have found hard-coded links in various php scripts and have changed them to http(they were hardcoded as https). I thought the redirects would handle this for me but it doesnt seem to work that way. I also searched for *.conf files but didnt find any, the site is hosted via hostgator on a dedicated server from what I know so not sure they give access to a httpd.conf file? I'm still confused as to why the redirects are not working? Would appreciate more advice. Thanks

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved