php - Page not found error on apache server on ubuntu 14.04


Question: 

I have a project which i developed using WAMP. The project works fine as expected. I tried to use the same project on LAMP stack (Ubuntu 14.04). I imported the database to mysql server and then copied the files to /var/www/html folder and gave permissions using chmod to all files in www folder. When trying to access the project using the localhost login page appears and the links on login page (register and contact pages) works fine.

But when trying to login using the username and password it give an 404 page not found error. but the page which was in the error message is available in the physical folder at the exact location.

what can be the reason for that?

<form role="form" name="loginform" action="mypages/components/login-process.php" method="post">
                                    <fieldset>
                                        <div class="form-group">
                                            <input class="form-control" placeholder="Username" name="username" autofocus>
                                        </div>
                                        <div class="form-group">
                                            <input class="form-control" placeholder="Password" name="password" type="password" value="">
                                        </div>
                                        <!-- Change this to a button or input when using this as a form -->
                                        <button type="submit" class="btn btn-lg btn-success btn-block" value="Log In" name="login_button"> Login</button>
                                        <br>
                                        <a class="login" href="mypages/stu/sturegform.php">Register as Student</a>
                                    </fieldset>
                                </form>

mypages/stu/sturegform.php it displays the page but the form action gives 404 error




2 Answers: 

The issue is here itself is your action.

If you're configuring in a UNIX environment either use the full path or the recursive path.

action="mypages/components/login-process.php"

If your myPages is in the same directory just put the PHP name or else you could use the full path as :

action="/var/www/html/mypages/components/login-process.php"

or if your path is a recursive path, you can use this way:

action="./mypages/components/login-process.php"

PS it applies to here also : href="mypages/stu/sturegform.php"

 

Your action and your form are not at the same level.

Your code is looking the login script at

mypages/stu/mypages/components/login-process.php

Change the action to

../components/login-process.php
 

More Articles


node.js - Querying multiple sensors regularly using NodeJS

I need to fetch the values of about 200 sensors every 15 seconds or so. To fetch the values I simply need to make an HTTP call with basic authentication and parse the response. The catch is that these sensors might be on slow connection so I need to wait at least 5 seconds for one sensor (but usuall

php - How to redirect everything after slash to domain before?

This is what I'm trying to do:I want example.com/car/{whatever} redirected to example.com/{whatever}. For example, example.com/car/honda should be redirected to example.com/hondaBUT if there is nothing after /car/, then just leave it as that. How can i do that in .htaccess ?

ruby on rails - tmux: are my other terminals still running?

I have started using a certain technique for launching my web code since I switched server setups. I type tmuxsudo startserverrailsCtrl+B then DThen to reboot I type tmuxsudo killall rubysudo startserverrailsCtrl+B then DMy questions are: when I kill the ruby, does that end the session that I starte


node.js - Not able to run my node app at port 80 on ubuntu 16.04

I want to run my node app at port 80 in ubuntu 16.04. But the moment I'm trying to run my app with npm start its throwing error Port in already in use whereas it's not in use. According to Github Reply, We need root privileges to run on ports below 1048 which is correct.So the moment I'm trying to r

shell - Move output of Find command unix

Im learning unix programming , i want to find all files whose size is greater than 1M an print them into a file.here is my code find. -size +1M -print0 | xargs -I -O '{}' mv '{}' files all sites i have found refer to this one as right one , but it does not work . currently im working on ubuntu

linux - Run a intotify sricpt in background

how can i run 12 bash scripts simultaniously in the backgroud?That's the script:#/bin/bashwhile inotifywait -e close_write /var/www/html/wp-content/QM-Handbuch /01-Inhaltsverzeichnis.doc; do soffice --headless --convert-to pdf /var/www/html/wp-content/QM-Handbuch/01-Inhaltsverzeichnis.doc &


mysql - How to install older PHP version in XAMPP on Ubuntu 16.04?

I'm trying to install Magento on my system, But it gives me an error that the PHP version that I have is newer and Magento is not supported that version. So now I'm trying to downgrade my PHP version from XAMPP that I'm installed on Ubuntu 16.04.Error : PHP Version Check Your PHP version is 7.1.1.

c - Printf ubuntu Segmentation fault (core dumped)

I have this code:int a;printf("&a = %u\n",(unsigned)&a);printf("a\n");printf("b\n");printf("c\n");printf("d\n");I tried to print the pointer of a variable.But it fail on the row printf("a\n"); and says Segmentation fault (core dumped)Output:&a = 134525024Segmentation fault (core dumped)W

ubuntu - Docker: bash terminal starts without prompt

I have a simple container that looks like this:FROM devbox/rails3.2.1RUN apt-get install -y -q libmysql-ruby libmysqlclient-devRUN apt-get install -y -q libqtwebkit-devEXPOSE 3000CMD /bin/bashwhere devbox/rails3.2.1 is a container I made that starts with 'FROM ubuntu' and installs Ruby on Rails. Thi

Segmentation fault: Stack allocation in a C program in Ubuntu when bufffer>4M

Here's a small program to a college's task:#include <unistd.h>#ifndef BUFFERSIZE#define BUFFERSIZE 1#endifmain(){ char buffer[BUFFERSIZE]; int i; int j = BUFFERSIZE; i = read(0, buffer, BUFFERSIZE); while (i>0) { write(1, buffer, i); i = read(0, buffer, BUFFE