cancel
Showing results for 
Search instead for 
Did you mean: 

How to Remove index.php from Magento URL

How to Remove index.php from Magento URL

Hello there,

I really want the /index.php/ removed from ALL of my URLs.

 

I´ve tried different tutorials, but it still doesen´t work.

 

Right now i can actually both write http://www.accugames.dk/ and http://www.accugames.dk/index.php/

And they will not redirect to each other.

 

This is the same situation in my backend. I can both connect to http://www.accugames.dk/index.php/backend/ and http://www.accugames.dk/backend/

 

So. I don´t want to be able to connect to both URLs. I only want to connect to http://www.accugames.dk/

 

So - in other words - i want the index.php removed and i don´t want to be able to connect to URLs which contains /index.php/

 

How to do that?

17 REPLIES 17

Re: How to Remove index.php from Magento URL

Hello,

 

Try adding the following code to your htaccess file.

 

RewriteEngine on
RewriteCond %{REQUEST_URI} !/admin/
RewriteRule ^index\.php/(.+)$ /$1 [R,L]
RewriteRule ^index\.php/?$ / [R,L]

 

This will also exclude the rule from applying in your admin panel, this can sometimes cause redirect loops!

 

Hope this helps, let me know.


Freelance Web Developer - Graphic Designer - SEO Analyst
Conor Rhys Tomkins

Re: How to Remove index.php from Magento URL

Thank you for your answer!

 

I have one question. Where in the file shall i add it?

 

And i can see 2 htaccess files in the root. Which of them shall i edit?

Re: How to Remove index.php from Magento URL

Hello,

This will need to be added to your main .htaccess file & not the sample.

Also make sure that you have your server rewrites enabled in your admin panel.

System -> Configuration -> Web - > Use Web Server Rewrites - > Yes

Hope this helps.


Freelance Web Developer - Graphic Designer - SEO Analyst
Conor Rhys Tomkins

Re: How to Remove index.php from Magento URL

Okay, I can´t connect to the index.php now. So that´s great. But something does still not work.

 

I can only connect to the frontpage. I can´t access any other pages. And I can´t go to backend.

 

Re: How to Remove index.php from Magento URL

Did you enable the rewrites in the admin panel?

 

It appears that your site is still trying to access /index.php but is been redirected by the newly added rule.

 

Let me know.


Freelance Web Developer - Graphic Designer - SEO Analyst
Conor Rhys Tomkins

Re: How to Remove index.php from Magento URL

Hello again,

 

Thank you for taking time!

 

I´ve done what you´ve said:

 

This is how my configuration file looks like

 

This is how my htaccess file looks like

Re: How to Remove index.php from Magento URL

Can someone please help me?

Re: How to Remove index.php from Magento URL

Hi.

 

Is there a specific reason you are trying to stop the urls being accessed directly with index.php in the url? As long as you have url rewrites on, even if someone (or a search engine) does go directly to the page (including the index.php in the url), all further links on the page will be without index.php anyway.

 

Sorry, i know this is not a solution but i'm not convinced at the moment a solution is required. Just trying to understand your issue a little but more.

 

Regards,

Andy

Problem solved? Click Accept as Solution!
www.iwebsolutions.co.uk | Magento Small Business Partner

Re: How to Remove index.php from Magento URL

@kasperdtb Sorry for the late response, extremely busy.

 

Make sure your rewrite base uncommented.

 

#RewriteBase /magento

 

@iweb_smartie SEO reasons.


Freelance Web Developer - Graphic Designer - SEO Analyst
Conor Rhys Tomkins