Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

htacces https

Posted on 2011-02-25
8
Medium Priority
?
327 Views
Last Modified: 2012-05-11
I have near to no experience with .htacces but i need to do the following

I have a ssl certificate for the whole website. But i only want to have a few pages secured the ssl.

example

http://www.vekto.nl/user_login.php
change to
https://www.vekto.nl/user_login.php

Now this is a easy redirect but i want a if statement implemented.

Because if the page is anything other than user_login.php i want to switch back to http
0
Comment
Question by:ScottNL1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 2

Expert Comment

by:leftcase
ID: 34978490
I'm presuming that you have already set up SSL on your server? If not, it looks like you're running Windows Server 2003 and IIS 6 so you will want to use this guide: http://support.microsoft.com/kb/299875

In terms of enabling https for the login page only via your .htaccess, I'm not entirely sure that's possible. If you're using cookies to pass sessions between pages, I don't believe you can pass them from https to http pages (or vice-versa). This post explains better than I can: http://www.codingforums.com/showthread.php?t=128416

Perhaps your solution will be a little more complicated?
0
 
LVL 2

Expert Comment

by:leftcase
ID: 34978493
Sorry, just re-read the categories you posted your question in and noticed 'Apache'. I guess Netcraft is misreporting your site: http://uptime.netcraft.com/up/graph?site=www.vekto.nl
0
 
LVL 1

Author Comment

by:ScottNL1
ID: 34978538
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . friendly_url.php [L]
RewriteCond %{HTTP_HOST} ^vekto\.nl [NC]
RewriteRule ^(.*)$ http://www.vekto.nl/$1 [L,R=301]

</IfModule>

This is what is have now and it works.

I would like to add this, but not for a folder just for a page

RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} payment
RewriteRule ^(.*)$ https://www.vekto.nl/payment/$1 [R,L]

If the user is not on one of the pages, i want to have a rule that it switches back to http.

Not fully understanding the 2 posts because i can redirect in my htacces. Just don't want to redirect a root folder, but a page

0
10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

 
LVL 26

Expert Comment

by:arober11
ID: 34992435
Just alter the port and negate the URL match e.g.
RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_URI} ! (payment|login|somethingElse)                           [NC]
RewriteRule .*                            http://www.vekto.nl/payment%{REQUEST_URI}  [R,L]

Open in new window

0
 
LVL 26

Expert Comment

by:arober11
ID: 34992437
Typo:
RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_URI} ! (payment|login|somethingElse)                           [NC]
RewriteRule .*                            http://www.vekto.nl%{REQUEST_URI}  [R,L]

Open in new window

0
 
LVL 1

Author Comment

by:ScottNL1
ID: 34995013
Thanks arober11

I tried it but didn't work for me

RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_URI} ! (user_login|user_home|user_profile|user_orders|order_info) [NC]
RewriteRule .* http://www.vekto.nl%{REQUEST_URI}  [R,L]

When i type

https://www.vekto.nl/user_login.php it redirects to http


0
 
LVL 1

Author Comment

by:ScottNL1
ID: 35007189
any body have any ideas?
0
 
LVL 26

Accepted Solution

by:
arober11 earned 2000 total points
ID: 35071811
Hi, next step is to add a temporary log file to the config, restart apache, surf for a few min's, then have a look at the log e.g.

{code}
RewriteLog  /temp/tmp-rewritelog
RewriteLogLevel 9
RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_URI} !(user_login|user_home|user_profile|user_orders|order_info) [NC]
RewriteRule .*                             http://www.vekto.nl%{REQUEST_URI}  [R=301,L]
{code}
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

721 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