Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»General Articles»How to Remove “public/index.php” from URL in Laravel

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

    RahulBy RahulDecember 1, 20181 Min ReadUpdated:December 15, 2018

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

    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:

    Apache
    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
    Previous ArticleHow To Install Zabbix Agent on Debian 10/9/8
    Next Article How to Upgrade Packages on Ubuntu via Command Line

    Related Posts

    How to Install Sublime Text 4 on Ubuntu 22.04

    2 Mins Read

    How to Install Apache ActiveMQ on Ubuntu 22.04

    3 Mins Read

    How to Find Django Install Location in Linux

    Updated:April 27, 20221 Min Read

    (Resolved) – ReactJS 404 Error on Page Reload

    2 Mins Read

    How To Install LAMP Stack on Ubuntu 22.04 LTS

    Updated:April 20, 20225 Mins Read

    Adding a New SSH Key in GitHub

    Updated:April 1, 20223 Mins Read

    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

    Recent Posts
    • How to Install Sublime Text 4 on Ubuntu 22.04
    • How to Enable / disable Firewall in Windows
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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