Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7440403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:50:46+00:00 2026-05-29T10:50:46+00:00

I have a single PHP file which handles credit card processing. It starts as

  • 0

I have a single PHP file which handles credit card processing. It starts as a form to input the credit card number, then becomes a “confirm” screen (showing the credit card number) then once more to process and display the results. All three loads will be done with PHP submits (I realize the confirm might be better as Javascript, but I didn’t write it). It is the only file in the directory which handles credit cards, and therefore it is the only one which needs httpS connection.

I tried enforcing this with the $_SERVER array, looking up the protocol used to connect from the prefix of the SCRIPT_URI (or other entry), but none had the prefix.

Is there a simple way to do this with the .htaccess file in the same directory? How do I enforce it for ONLY that one file? If there’s any other simple way, how would I do it?

Sorry for the questions, but my searches thus far here haven’t uncovered a working solution, and I’m afraid I don’t know what the best practice is.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:50:47+00:00Added an answer on May 29, 2026 at 10:50 am

    At the beginning of the PHP page that does all your credit card processing, you can add this:

    It will redirect back to itself, except using https if it was first loaded over http. Of course you still need an SSL certificate installed for your domain.

    if (!isset($_SERVER['HTTPS']) || !$_SERVER['HTTPS']) { // if request is not secure, redirect to secure url
        $url = 'https://' . $_SERVER['HTTP_HOST']
                          . $_SERVER['REQUEST_URI'];
    
        header('Location: ' . $url);
        exit;
    }
    

    I use this same logic in PHP to secure my entire domain by putting that in file that is always called at the beginning of every request for my site.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a flash application which uses a single php file to retrieve records
Is that possible to have a single PHP SOAP server which will handle requests
I have already a site with a single homepage index.php which accepts 2 parameters
Hi I have a web form that sends a string to one php file
I have the following file which process a single XML file and pushes it
I have a single PHP file that i require in many different php files.
I have a study logout.php file which works fantastically, the issue I am faced
I have got a single file in which I need specify classes in multiple
Basically I have a single page on my site that I want any php
I realized that I can have problems with single quotes in php arrays: <?php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.