codeigniter remove index.php form url

后端 未结 5 758
甜味超标
甜味超标 2021-01-20 15:53

I am trying to remove \"index.php\" from url in Codeigniter. I know how to remove index.php from base url like this example.com/controller.

But i do

5条回答
  •  有刺的猬
    2021-01-20 16:48

    Quick solution

    RewriteEngine On
    RewriteCond %{HTTP} off
    RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    

    If facing problem

    You might have to check if modrewrite is installed and enabled in your apache.

    Enable modrewrite

    sudo a2enmod rewrite
    
    

    Also make sure

    sudo vi /etc/apache2/apache2.conf
    

    And allow symbolic link

    
            Options Indexes FollowSymLinks
            AllowOverride None
            Require all granted
    
    

    Restart apache2 and your .htaccess should be working fine.

    Read the last step at: https://www.inteligentcomp.com/2017/07/how-to-setup-and-configure-lamp-on-ubuntu-server.html

提交回复
热议问题