http: -> https via mod rewrite?

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

http: -> https via mod rewrite?

Postby laura » Tue Sep 09, 2003 7:30 am

Hi, I'm hoping someone can help me with something.

I have a site that uses a template to contstruct its pages. This includes an external .js file that controls my dhtml menu.

What I'd like to happen is when you hit the secure part of the site, an online store, all the links to graphics written like http://www.domain.com/myimage.gif get accessed as https://secure.domain.com/myimage.gif

I'm basically trying to avoid the message about 'this page has mixed secure and nonsecure content' without having to create a duplicate template and js file.

Is it possible to do this with Mod Rewrite? I'm not sure how to test if a graphic file is being loaded into a secure html page for one, or if redirecting to the secure url will circumvent the error message.

Any help on this would be greatly appreciated, thank you.
laura
 

Postby pippo » Tue Sep 09, 2003 1:23 pm

Hi Laura,
I think you can do this:

/.htaccess
Code: Select all
RewriteEngine On
# Check that the current port is 80
RewriteCond %{ SERVER_PORT} ^80$
RewriteRule ^(myimage|pippo|etc)\.gif$ https://secure.example.com%{REQUEST_URI} [P,NC]


the P means that a proxy request will be done to the https server.
mod_proxy needs to be enabled into your httpd.conf

That should work...:)


Thanks,
:) Mr Andrea
pippo
 
Posts: 6
Joined: Sat Sep 06, 2003 11:27 pm


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 47 guests

cron