Search code examples
expressionengine

How do I remove/fix that Expressionengine adds "index.php" in urls of template groups that has nothing to do with the index page


I'm having a weird issue with expressionengine. I have a website home page which i have created a template group for called "index". Inside index template group theres the index page template which works as expected, www.domainname.com/ goes to the index.php page. What I have an issue with is if I add other template groups, those urls will look like this:

www.domainname.com/index.php/template_group_name/template_file

I'm not sure what am I doin wrong, as in their docs the url should look like this: www.domainname.com/template_group_name/template_file

How do I remove that index.php from the domains?


Solution

  • found it, it was hidden somewhere in their manual, anyone else having the same issue, paste the following in the .htaccess file:

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /
    
        # Removes index.php from ExpressionEngine URLs
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{REQUEST_URI} !/system/.* [NC]
        RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
    
        # Directs all EE web requests through the site index file
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php/$1 [L]
    </IfModule>
    

    source: https://docs.expressionengine.com/latest/installation/best-practices.html#removing-indexphp-from-your-urls