Tricky problem with mod_rewrite and SSL

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

Tricky problem with mod_rewrite and SSL

Postby Ooompa » Mon Jul 20, 2009 4:36 pm

Hello everyone,

I have a website that has a lot of images and style sheets. Unfortunately I cannot give them relative paths in my HTML, only static paths because they are hosted on a separate server (that I control).

The problem I'm having is that on one page (credit card input) I have setup an SSL connection, however all images and css files are handled over HTTP and thus the browser doesn't like that and displays errors. My question is how (if possible) could I use mod_rewrite to tell the server to serve all images, css files, and javascript files over an SSL connection if (and only if) the user happens to be on the credit card page (so even if I request an image from http://www.example.com/images/1.jpg the server would send it over an SSL connection).

I have access to both servers, and both servers have an SSL certificate. Any ideas, or suggestions?
Ooompa
 
Posts: 1
Joined: Mon Jul 20, 2009 12:20 pm

Postby richardk » Mon Jul 20, 2009 4:45 pm

I have access to both servers, and both servers have an SSL certificate. Any ideas, or suggestions?

Edit the links on the credit card processing page to be https not http.

Mod_rewrite can't change the links/paths in a page, it works on incoming requests only so by the time mod_rewrite runs the http request will already have been made and the error will have shown up.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 30 guests

cron