Remove # from url in Angular JS and Laravel 5

To remove # from Angular JS application built with Laravel , add following line in your config.

Add this in your head tag

Now it will work fine till you do not refresh the page. If you refresh your page at this point, you will see page not found error, it is because now browser sends request to server and server doesn’t have the route.

To do this we will add this route at the end of routes.php

 

 

  • Gurpal Singh

    Not working every time redirected to home page when i click on any link or button

    • http://devendraverma.com/ Devendra Verma

      Hi @disqus_GLKctdbk2t:disqus do you have a single page angular application or is it with any server side framework like laravel, codeigniter or expres js etc.

      • Gurpal Singh

        yes i am working on framework like laravel 5

        • http://devendraverma.com/ Devendra Verma

          Can you please post your route.php here

          • Gurpal Singh

            Now its working fine. There are interceptor problem that i had used. So it is redirected to home page. Many-2 thanks Devendra

          • http://devendraverma.com/ Devendra Verma

            Glad to know that 🙂

  • Varun

    can you please post the routes.php code for code igniter