Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»General Articles»How to Remove “public/index.php” from URL in Laravel

    How to Remove “public/index.php” from URL in Laravel

    By RahulDecember 15, 20181 Min Read

    Create or edit the .htaccess file in the Laravel root directory and configure the RewriteRule to remove “public/index.php” from the URL.

    Advertisement

    You must have mod_rewrite enable on your Apache server. The rewrite module is required to apply these settings. You also have enabled .htaccess in Apache virtual host for Laravel.

    Edit the .htaccess file so that it contains the following code:

    1
    2
    3
    4
    <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteRule ^(.*)$ public/$1 [L]
    </IfModule>

    Now you should be able to access the website without the “/public/index.php/” part.

    Apache htaccess Laravel
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to Split Large Archives in Linux using the Command Line

    System.out.println() Method in Java: A Beginner’s Guide

    sleep Command in Linux with Examples

    View 2 Comments

    2 Comments

    1. Stephane Winnepenninckx on August 10, 2019 1:03 pm

      Rahul, this probably works for the ‘/’ route. I’m in trouble with the ‘/mypage’ route. To let it work I have to use ‘/index.php/mypage’ witch is not so nice. Can you teel me how to get rid of index.php for this kind of route?

      Reply
    2. tester on March 20, 2019 11:07 am

      not work in local server like xampp

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to Split Large Archives in Linux using the Command Line
    • System.out.println() Method in Java: A Beginner’s Guide
    • Split Command in Linux With Examples (Split Large Files)
    • Test Your Internet Speed from the Linux Terminal
    • 11 Practical Example of cat Command in Linux
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.