Jump to content

redirect http:// to https://


uberweiss

Recommended Posts

it means you already sent code to to client. headers are the first thing to be sent, and must be output to the client before anything else. but i'm assuming you're echoing a "you're being redirected" msg or something similar. just move the header() up to before you output anything else. however, i'm not sure anything after that will get displayed...

Link to comment
Share on other sites

A lot of people say that you should always place headers at the top of the page. This is not entirely true. You should structure your code and display everything at the end of the page, not in little droplets. A lot of people echo on the fly, then encounter header errors so they use output buffering. Output buffering is not a solution, merely a bandage to hide the wound. Properly structured code will eliminate header errors.

Link to comment
Share on other sites

I did. you can see the code below...

 

<?php
header('Location: https://www.mysite.com/script.php');
?>
<form name="upload-form" id="upload-form" method="post" action="./upload.php" enctype="multipart/form-data"> 
  <input type="hidden" name="MAX_FILE_SIZE" value="1024000"> 
  <fieldset> 
  <legend>File upload:</legend> 

  <dl> 

<dt> 
      <label for="file">File:</label> 
    </dt> 
    <dd> 
      <input tabindex="1" accesskey="b" name="file" type="file" id="file" /> 
    </dd> 
  </dl> 
  <input tabindex="2" accesskey="l" type="submit" name="cmdupload" value="Upload" /> 
  </fieldset> 
</form>

Link to comment
Share on other sites

I added the suggested code to my httpd.conf file in the <location> block, removed the comment # and rebootet the server. But it didn't work. where should i put the .htaccess file in order to try that.

 

I'm starting to get a bit annoyed at this, to think something that sounds so easy could be so frustrating.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.