Forum Moderators: phranque

Message Too Old, No Replies

Insecure pages redirecting to secure pages

         

chuckee

12:18 pm on Sep 27, 2007 (gmt 0)

10+ Year Member



Hi,
I have all of my website in one main root directory, however there are some subdirectories in which I want people to only be able to access the PHP and HTML files if they have connected securely (i.e. by using https:// rather than [)...] to view the files in those directories.

Is there some way that I can automatically redirect anyone who attempts to access these directories (one of them is the 'signup' directory) so that they view the secure version of the same page instead of the insecure version? Basically this would just mean telling them to go to the exact same page but replacing http with https.

Many thanks!

jdMorgan

12:31 pm on Sep 27, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, use mod_rewrite to check the URL-path for the secure directory or directories, and if SERVER_PORT is not 443, then redirect to the same URL-path, but using https as the protocol.

There are many threads here on the subject of redirecting between http and https [google.com].

Jim