Reputation: 6625
I am using the PHP-login.net framework for a login and I am hosting the folder in a subfolder of another website and using htaccess to redirect it to the main domain I created for that subfolder.
RewriteCond %{HTTP_HOST} ^(www.)?decathlon.ga$ [NC]
RewriteCond %{REQUEST_URI} !^/decathlon/.*$
RewriteRule ^(.*)$ /decathlon/$1 [L]
It worked fine when I had it just as saint57records.com/decathlon but when I added the redirect the POST data is not being sent from this form. However, all links are redirecting as they should.
<form action="http://decathlon.ga/login/login" method="post">
<label>Username (or email)</label>
<input type="text" name="user_name" required />
<label>Password</label>
<input type="password" name="user_password" required />
<input type="checkbox" name="user_rememberme" class="remember-me-checkbox" />
<label class="remember-me-label">Keep me logged in (for 2 weeks)</label>
<input type="submit" class="login-submit-button" />
</form>
On the page it goes to it performs this check and gives me the error that the POST is empty.
http://decathlon.ga/login/login
portion below
if (!isset($_POST['user_name']) OR empty($_POST['user_name'])) {
$_SESSION["feedback_negative"][] = FEEDBACK_USERNAME_FIELD_EMPTY;
return false;
}
So everything is redirecting to the right place but does someone understand what might be going on with the POST data because of the redirect?
Upvotes: 1
Views: 174
Reputation: 785196
Your shown rule is not doing any external redirect, it is just an internal rewriting. Hence POST data will be preserved during this routing to /decathlon
directory. I would suggest you to check presence of other rules doing this redirect. External redirect can also be caused by other module like mod_dir
if login/login
is a real directory.
As an alternative you can even avoid this rewrite by directly using /decathlon/
in the form's action path:
<form action="http://decathlon.ga/decathlon/login/login"
Upvotes: 1
Reputation: 44831
It's not 100% clear to me what you're trying to do, but you are redirecting everything not matching ^/decathlon/.*$
to /decathlon/$1
. That means that http://decathlon.ga/login/login
redirects to http://decathlon.ga/decathlon/login/login
, which seems wrong.
You need to rewrite your second RewriteCond
and your RewriteRule
, but it's impossible to guess what they should be without more information.
Upvotes: 2