duanfen2349 2018-10-27 00:38
浏览 54

Laravel Routes on Webserver

I Have a question to Laravel. I made an Web Application with Laravel. On my local machine everything works perfect now i did it on the Host and here i struggle a little. When i call the site it goes first to my Controller and then to my view and that works fine. but in my view i have some forms and they don't work at all.

On my local machine i would send the form like this:

<form id="main-contact-form" name="contact-form" method="post" action="/SendMail">
            <div class="row  wow fadeInUp" data-wow-duration="1000ms" data-wow-delay="300ms">
              <div class="col-sm-6">
                <div class="form-group">
                  <input style="background-color:black; color:white" type="text" name="name" class="form-control" placeholder="Name" required="required">
                </div>
              </div>
              <div class="col-sm-6">
                <div class="form-group">
                  <input style="background-color:black; color:white" type="email" name="email" class="form-control" placeholder="Email Address" required="required">
                </div>
              </div>
            </div>
            <div class="form-group">
              <input style="background-color:black; color:white" type="text" name="subject" class="form-control" placeholder="Subject" required="required">
            </div>
            <div class="form-group">
              <textarea style="background-color:black; color:white" name="message" id="message" class="form-control" rows="4" placeholder="Enter your message" required="required"></textarea>
            </div>
            <div class="form-group">
              <button type="submit" class="btn-submit">Sende Nachricht</button>
            </div>
          </form>

And in my web.php file i would define the route like this

Route::post('/SendMail', 'MyController@SendMail');

And on the local machine this works perfect but not on the Host here i am getting the error 404 object not found. Why ? Please Help me and i am sorry for my bad english but i hope you still understand what i mean

  • 写回答

3条回答 默认 最新

  • dongying6179 2018-10-27 00:52
    关注

    My first thought is do you have the Apache mod_rewrite enabled on your server? I am assuming you are running Apache and Linux here. It is needed to make URL rewriting work.

    On Linux you would typically run these commands:

    sudo a2enmod rewrite
    sudo service apache2 restart
    
    评论

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制