Since setting up a redirect in .htaccess I have achieved my goal of forcing WWW. and removing all .php extensions. However I don't think the use of https is working as my $_post is now null on submitting my form. Please help.
UPDATE -- HTTPS I think is ok. I remove the last two rows of my .htaccess code dealing with removing of php extensions and my form works again. So the questions is now, how do I remove the php extensions on the website without losing my $_POST data. -- UPDATE
I've tried switching between %{SERVER_PORT} 80 and %{HTTPS} !on in my .htaccess
Here is my .htaccess code:
DirectoryIndex index.php
Options +FollowSymlinks
RewriteEngine on
Rewritecond %{HTTP_HOST} ^example.co.uk [NC]
#Tried using... Rewritecond %{SERVER_PORT} 80
RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ https://www.example.co.uk/$1 [L,R=301,NC]
# This hides the php extensions
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]
Here is my form mark up:
<form autocomplete="off" name="productRequest" enctype="multipart/form-data" action="<?php echo "..".$_SERVER['PHP_SELF']."?item=".$item."&design=".$design."&option=".$option."&add=Y"; ?>" method="POST">
Note I have tried https://www.example.co.uk.$_SERVER['PHP_SELF'] too
When the form calls itself I have:
$item = $_GET['item'];
$design = $_GET['design'];
$option = $_GET['option'];
$add = $_GET['add'];
if(!isset($item))
{
header('Location: ../index.php');
exit;
}
else if($add=='Y')
{
print_r($_POST);
exit;
}
I just get: Array ()