CAll Us: USA +1 9176775553   Login

remove index.php from url in magento

How to remove index.php from url in magento

Ans :

If you want to access your magento URL without index.php

for example:


then use the following steps

1) Login to admin section by using the URL

2) then go to “System >>  Configuration >>Web >> Search Engines Optimization”
Use Web Server Rewrites : YES

3) Go to “System >>  Configuration >>Web >>Secure”

Use secure URL Frontend: YES

4)Then create the .htaccess file under your the magento installed folder.

If the magento installed under document root ( /home/username/public_html) then add follogig rules into .htaccess file

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

and If the magento installed under /shop or directory then add the following rules into ” /home/username/public_html/shop/.htaccess ” file.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /shop/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /shop/index.php [L]


27 thoughts on “remove index.php from url in magento

  1. Niyi - December 7, 2010 at 1:37 am

    Thanks. It worked spot on!

  2. Gerry - January 9, 2012 at 12:54 am

    Thank you so much, worked like a charm!

  3. Rajnish - January 28, 2013 at 5:32 pm

    now working i tried all the things 🙁

  4. Rajnish - January 28, 2013 at 5:35 pm

    sorry its not working by mistake i typed now* 😛

  5. Rishikesh Vispute - February 4, 2013 at 7:51 am

    Please send your domain name and cpanel login details and also magneto login details at
    So I can check the setting and try to solve your issue.

  6. amoii - May 27, 2013 at 1:56 pm

    i’m using magento,it took me nearly a half day to dig on the internet to find a perfect solution,until i found your post.when i was trying to follow your steps i suddenly worked it out.

    My problem is that i unzipped the and moved all the files into the website root. however the hidden .htaccess and .htacess-sample were not moved to the website root,still stayed in the folder”magento”.so i changed the setting of my CuteFtp to show hidden files,and moved these 2 files into the root.

    All i did is only the setp 2 you mentioned above,all worked well,don’t need to touch /change any codes in the .htaccess or any other configuration in the magento admin panel.

    hope this helps to someone which the problem is the same.

  7. Topic - January 15, 2014 at 2:38 am

    Thank you kind person for putting the best solution up~! I found my root .htaccess was empty, with all the information in the .htaccess.sample – that was where I spent most of my time making the adjustments which had no effect. Finally I pasted your code into the empty .htaccess file, and voila, it works!

  8. pankaj - February 19, 2014 at 11:08 am

    Thanks worked perfectly…i tried lots of other things but nothing worked for my extra installation of magento in sub-directory ..thanks a lot..cheers

  9. Musaver - February 28, 2014 at 2:30 pm

    I have done all the steps and it works, index.php removed, But now when I open category then it shows 500 internal error, and if I manually add index.php in URL then it will work.

  10. Rishikesh Vispute - March 1, 2014 at 6:31 pm


    Please follow steps once again and and if you are still facing same error then check server logs

  11. Pasindu - March 25, 2014 at 8:59 am

    Did you find any solution. I am also has the same issue which you mentioned above. If you can please give me a solution..

  12. Prateek Dahiya - April 22, 2014 at 7:50 am

    Thanks you for the post Bro…..

  13. Brendan - May 21, 2014 at 10:34 am

    Thanks for posting this Rishikesh we moved our magento site from one server to another and none of the links would work.

    I was tearing my hair out for two days trying to fix it before I found this post.

    This fixed it for me.

    Thank you!!

  14. rohit - May 22, 2014 at 5:12 pm

    yes it is not work also in my site
    i use IIS 7 and magento 1.8.1
    please replay if anybody has a solution…

  15. Marty - May 27, 2014 at 12:29 pm

    Thanks so much for this – it’s something that, as an SEO, has bugged me for some time – now my URLs look sexy again!

  16. james - May 30, 2014 at 8:59 pm

    Thank you for this post, worked perfectly.

  17. masoud - July 22, 2014 at 4:39 am

    Thanks you very much …

  18. Patrick Vrijman - September 7, 2014 at 10:19 am

    It worked for me! fair and simple. Thank you.

  19. Chanel J. - September 9, 2014 at 10:38 pm

    This worked perfectly! Thank you so much!!

  20. Keerti - September 18, 2014 at 6:36 am

    Thanks ! For this easy and simple way …

  21. Davey - September 19, 2014 at 8:29 am

    thank you verry much!

  22. Farukhkhan - December 1, 2014 at 5:35 pm

    Thank you so much 🙂 Its 100% works!

Leave a Reply