.htaccess file causing 505 error in 000webhosting

24 Views Asked by At

This is my very first time hosting anything on a shared service so bare with me.

I am getting a 500 error when trying to log in via AJAX to a file called process-login.php Here is my javascript code:

$("#button-login").click(function (e) {
        e.preventDefault();
        let password = $("#password").val().trim();
        let username = $("#username").val().trim();
        console.log(window.location.pathname);
        console.log(window.location.href);

        $.ajax({
            type: "POST",
            url: "./Login/process-login.php",
            data: { username: username, password: password },
            success: function (response) {
                if (response.trim() === "Error") {
                    $("#error-message")
                        .removeClass("hiddenText")
                        .text("Invalid username or password")
                        .css('color', 'red');
                    $(".form").addClass("shake");
                    setTimeout(function () {
                        $(".form").removeClass("shake");
                    }, 500);
                } else if (response.trim() === "1") {
                    window.location.href = "./ChassisPreparation";
                } else {
                    // get the first page he can go to
                    goToFirstRolesPage(username);
                }
            },
            error: function (xhr, status, error) {
                $("#error-message").text(error).removeClass("hidden");
            }
        })

The error seems to be with accessing the process-login.php file. It works completely fine on my laptop (using XAMPP). Here is my htaccess file:

RewriteRule ^ChassisPreparation$ SheetOne/sheet-one.php [NC,L]
RewriteRule ^ChasisMilling$ SheetTwo/sheet-two.php [NC,L]
RewriteRule ^Email$ Profile/change-email.php [NC,L]
RewriteRule ^SignIn$ Login/login.php [NC,L]

AuthType Basic 
AuthName "example" 
AuthUserFile /storage/ssd1/182/21715182/.htpasswd
require valid-user



ErrorDocument 404 /DLOC/Error404/error404.php

Here are some pictures showing the folder structure:

Root Folder

Inside the Login folder is:

Inside Login folder

0

There are 0 best solutions below