0

my local laravel project is working well. but after hosting project with live server it is working all except contact us form. this is my contact form

<div class="content">
@include('partials.alerts')
    <h1 class="heading">Contact Us</h1>
    
    
    <form method="post" action="{{url('form')}}#contact">
            {{csrf_field()}}
            <div class="form">
  <div class="input-flex">
    <input type="text" name="name" placeholder="Name*" /><br><br>
    <span style="color:red">@error('name'){{$message}}@enderror</span>
    <input type="email" name="email" placeholder="E-mail*" /><br><br>
    <span style="color:red">@error('email'){{$message}}@enderror</span>
    <input type="tel" class="full-width" name="telephone" placeholder="Phone number*" /><br><br>
    <span style="color:red">@error('telephone'){{$message}}@enderror</span>
    <textarea cols="2" rows="2" class="full-width" name="message" placeholder="Message"></textarea>
    </div>
  <button  class="conbtn" type="submit">Submit</button>

and my scrolling navigation for contact is

<nav class="navbar">
   <a href="#contact">contact</a>
</nav>

and controller for contact us is

protected function store(Request $request)
    {
        //validate request
        $this->validate($request,[
            'name' => 'required|max:100',
            'email' => 'required|email',
            'telephone' => 'required',
        ]);

        $user = new User;

        $user->name = $request->input('name');
        $user->email = $request->input('email');
        $user->telephone = $request->input('telephone');
        $user->message = $request->input('message');
        
        $user->save();

        $verifyUser = VerifyUser::create([
            'user_id' => $user->id,
            'token' => Str::random(40)
        ]);

        Mail::to($user->email)->send(new VerifyMail($user));

      return redirect('/#contact')->with('info', 'We sent you an activation code. Check your email and click on the link to verify');
    }

my contact us verification message and for validation messages redirect to contact section after submitting submit button. this system working well in my local machine. but in live server got following error message Sorry, this page doesn't exist. Please check the URL or go back a page. 404 Error. Page Not Found.

and I can monitor there are different urls in my local and live server after submitting contact form localhost is like http://localhost:8000/#contact

but live server is like https://academi.com/form#contact

I am confused with this. how could I fix this problem

maramodaya
  • 49
  • 8

1 Answers1

0

I would check your server configuration. If it is working locally but not on a live server then it is probably something wrong there. Check your apache/nginx config matches for both, especially around rewriting urls

joshpj1
  • 186
  • 1
  • 1
  • 9