I was searching now quite a bit on the internet but can not find any solution. I have an .htaccess file, which rewrites my query string into the GET variable. This works absolutely fine.
when it comes to the POST variable, it is the first time I get into this trouble. I have used this .htaccess file already a lot of times on different servers, but now one of my client's server doesn't want to work. When ever I post a form the whole POST variable is empty... I will post my .htaccess file, any help is appreciated.
Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteBase /
RewriteRule ^pages.*$ /error/404 [L]
RewriteRule ^classes.*$ /error/404 [L]
RewriteRule ^templates.*$ /error/404 [L]
RewriteRule ^common.*$ /error/404 [L]
RewriteRule ^([A-Za-z0-9-_]+)/?$ /?p=$1&s=index&a=index&n=index&%{QUERY_STRING} [L]
RewriteRule ^([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/?$ /?p=$1&s=$2&a=index&n=index&%{QUERY_STRING} [L]
RewriteRule ^([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/?$ /?p=$1&s=$2&a=$3&n=index&%{QUERY_STRING} [L]
RewriteRule ^([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/?$ /?p=$1&s=$2&a=$3&n=$4&%{QUERY_STRING} [L]
RewriteRule ^([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/?$ /?p=$1&s=$2&a=$3&n=$4&o=$5&%{QUERY_STRING} [L]
ErrorDocument 404 /error/404.php
the form looks like this
<div class="login">
<form action="/administrator" method="post">
<table cellspacing="0" cellpadding="0" width="100%">
<tr>
<td>Username</td>
<td><input type="text" name="username" /></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="passwort" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="Anmelden" /></td>
</tr>
</table>
</form>
</div>
and the login php file like this
<?php
session_start();
if( isset($_SESSION['login']) && $_SESSION['login'] === TRUE ) {
header('Location: /administrator');
exit;
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$username = $_POST['username'];
$passwort = $_POST['passwort'];
$hostname = $_SERVER['HTTP_HOST'];
$path = dirname($_SERVER['PHP_SELF']);
if ($username == 'xxx' && $passwort == 'xxx') {
$_SESSION['login'] = true;
header('Location: /administrator');
exit;
}
}
?>
Your RewriteRule are active for GET, not for POST.
check if your /administrator
script (why haven't you called it directly as administrator.php?) is called or create a rule for its access. Check in the access log to be sure you're calling the script when you post to it.
Add something like :
RewriteRule ^administrator administrator.php [L]
RewriteRule ^administrator pathtoyourscript/administrator.php [L]
check without session to be sure it's not interacting badly with it.
You can use var_dump($_POST) to display all data. If there is no display, you've not called the right script or your path is wrong.