简体   繁体   English

在Ubuntu 14.04上的Apache服务器上找不到页面错误

[英]Page not found error on apache server on ubuntu 14.04

I have a project which i developed using WAMP. 我有一个使用WAMP开发的项目。 The project works fine as expected. 该项目按预期工作正常。 I tried to use the same project on LAMP stack (Ubuntu 14.04). 我试图在LAMP堆栈(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. 我将数据库导入mysql服务器,然后将文件复制到/ var / www / html文件夹,并使用chmod授予www文件夹中所有文件的权限。 When trying to access the project using the localhost login page appears and the links on login page (register and contact pages) works fine. 当尝试使用localhost登录页面访问项目时,登录页面上的链接(注册和联系页面)可以正常工作。

But when trying to login using the username and password it give an 404 page not found error. 但是,当尝试使用用户名和密码登录时,会显示404页面未找到错误。 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 mypages / stu / sturegform.php,它显示页面,但表单操作给出404错误

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. 如果您在UNIX环境中进行配置,请使用完整路径或递归路径。

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 : 如果您的myPages在同一目录中,则只需输入PHP名称,否则您可以使用完整路径作为:

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" PS它也适用于这里: 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM