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:
http://domain.com/index.php/category
to
http://domain.com/category
then use the following steps
1) Login to admin section by using the URL
http://domain.com/index.php/admin
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]
</IfModule>

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]
</IfModule>

Done

27 Thoughts to “remove index.php from url in magento”

  1. Niyi

    Thanks. It worked spot on!

  2. Thank you so much, worked like a charm!

  3. Rajnish

    now working i tried all the things 🙁

  4. Rajnish

    sorry its not working by mistake i typed now* 😛

    1. Hello,
      Please send your domain name and cpanel login details and also magneto login details at rushivispute1@gmail.com
      So I can check the setting and try to solve your issue.

  5. amoii

    i’m using magento 1.7.0.2,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 magento-1.7.0.2.zip 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.

    1. Thanks for comments and If you like my post and if you want to donate then you can donate it for my site by using the URL
      http://www.indianwebportal.com/donate-for-future-help

  6. 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!

    1. Hello, Thanks for comment and I want to share more information to client.
      http://www.indianwebportal.com/donate-for-future-help

  7. pankaj

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

  8. Musaver

    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.

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

    2. Pasindu

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

      1. rohit

        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…

  9. Thanks you for the post Bro…..

  10. 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!!

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

  12. Thank you for this post, worked perfectly.

  13. I was follow you step but i am getting the 500 internal server error Please check
    Please check this and answer me ASAP my client is waiting for updates
    http://www.pastafilsan.co/mobile.html
    http://www.pastafilsan.co/admin
    Thanks in advance

  14. Thanks you very much …

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

  16. This worked perfectly! Thank you so much!!

  17. Keerti

    Thanks ! For this easy and simple way …

  18. Thank you so much 🙂 Its 100% works!

Leave a Comment