WebFaction
Community site: login faq

I am running a static PHP/CGI app.

I would like to serve one (just one) of the PHP files as https - so if the user navigates to http://domain/secure.php, forward them to https://domain/secure.php.

Is this possible, and if so how?

many thanks!

asked 31 May '11, 05:39

AnnaPS
10711020
accept rate: 100%


There is no option to enable HTTPS for just a single page, so you will need to have the entire application available both over HTTP and HTTPS.

You can then use mod_rewrite rule to enforce HTTPS access for the particular page. The rewrite rules would looks something like this:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule /secure.php(.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
permanent link

answered 31 May '11, 05:47

tie
1.4k13
accept rate: 44%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×262
×31

question asked: 31 May '11, 05:39

question was seen: 4,553 times

last updated: 31 May '11, 05:47

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM