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

  • SEARCH
  • Home
  • 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 8879145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:53:13+00:00 2026-06-14T19:53:13+00:00

Recently, for no ‘apparent’ reason, my login form started to redirect to my website’s

  • 0

Recently, for no ‘apparent’ reason, my login form started to redirect to my website’s 404 page, and I don’t see the cause anywhere.

 <?php echo '<form action="http://' . $_SERVER['SERVER_NAME'] . '/login" method="post">'; ?>
 <li><input type="text" name="username" placeholder="Username"></li>
 <li><input type="password" name="password" placeholder="Password"></li>
 <li><input type="submit" value="Login"></li>
 </form>

Yet for some reason, it still redirects to the 404 page, when <?php echo'http://' . $_SERVER['SERVER_NAME'] . '/login is the exact same page. Apart from when the user is successfully logged in, there is no other redirecting, which goes to a different page. I just don’t see what’s causing this, can anyone else work out why?

EDIT:
My .htaccess is

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?page=$1

Authentication code:

<?php
if(empty($_POST) === false) {
   $username = $_POST['username'];
   $password = $_POST['password'];

   if(empty($username) === true || empty($password) === true) {
      $errors[] = 'You need to enter a username and password.';
   } else if (user_exists($username) === false) {
      $errors[] = 'We can\'t find that username. Have you registered?';
   } else if (user_active($username) === false) {
      $errors[] = 'You haven\'t activated your account!';
   } else if(strlen($password) > 32 ) {
        $errors[] = 'Password to long.';
   }
     $login = login($username, $password);
     if($login === false){
       $errors[] = 'That username/password combination is incorrect.';
     }else{
        $_SESSION['user_id'] = $login;
        header('Location: ' . $_SERVER['SERVER_NAME'] . '/?msg=1');
        exit();

     }
   }
if(empty($errors)===false){
?>
    <h1>We tried to log you in, but....</h1>
<?php
     print_r($errors);
} ?>
  • 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-06-14T19:53:15+00:00Added an answer on June 14, 2026 at 7:53 pm

    Can you leave out the $_SERVER[] arrays and use static url, just for debugging?
    like:

    <form method="POST" action="url.php">
    <li><input type="text" name="username" placeholder="Username"></li>
    <li><input type="password" name="password" placeholder="Password"></li>
    <li><input type="submit" value="Login" name="submit"></li>
    </form>
    

    and:

     header('Location: url.php?msg=1');
    

    If it is giving you a 404 Error, it must be either from this or your .htaccess
    Debug it this way and let us know.

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

Sidebar

Related Questions

Recently the PHP manual started showing the following warning on every mysql function page:
Recently my iPad started to display these random characters when I open a website.
Recently, I am going to make a instant-notification system for my website. I heard
Recently, I started changing some of our applications to support MS SQL Server as
recently I started using storyboard and I've the following situation: I want to set
Recently two users of our software from the same company started experiencing random closures
Recently users of my website complained about the lack of support to IE6\7. Is
Recently I started using Sublime Text 2 for Rails application and I found it
Recently my records started to disappear from my application's database so I want to
Recently I started working with RAD and WebSphere on development of web services and

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.