Problem With Solutions

Something Different In Linux

Home » CMS » magento » remove index.php from url in magento

remove index.php from url in magento

Posted by Rishikesh Vispute Categories: 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 Responses so far.

  1. Niyi says:

    Thanks. It worked spot on!

  2. thank you ! your answer is super direct and it just simply works ! thank you again

  3. andy says:

    Hi… this worked great for my magento site. [L] does this denote a permanent re-direct? Does it matter to SEO if I make it permanent redirect?

    I also have the wordpress using the fishpig’s plug in. My link is broken for the blog. Do I need to re-write the wordpress htacc? if so, can you help please?

    Thanks

  4. Bhanu says:

    This is what i was looking for, I have updated the Magento and face many problem, this caused my ranking down in Search Engine.

  5. pq says:

    beautiful! works.

  6. Mana says:

    Thanks it works!

  7. Manimaran says:

    Hey,

    Its Really Great. Thanks for sharing. Its very helpful for Magento Beginners.

    Thanks.

  8. Linus says:

    Doesn’t work for me, except home is nothing working, all error 404.
    What am I doing wrong?

    Thanks

  9. Van says:

    Thanks a ton my friend, it worked really well. Much appreciated.

  10. Tyler says:

    Fixed it, went into phpmyadmin and went to core_config_data and took out the index.php at the end of the site..

  11. Joel says:

    My customer’s shop is set up as http://www.domain.com/magento

    where the installation is in the magento folder in the www root (they’re running on IIS, not Apache).

    The base url field is set to http://www.domain.com/magento

    The following rewrite rules are being used (and work, though I believe I will need to add an exception for the search to work).

    What changes do I need to make in the Magento installation, and the rewrite/redirect rules so that customers may use the site with the url form of http://www.domain.com/category_name instead of http://www.domain.com/magento/category_name?

    Basically, I want to be able to remove the magento portion of the url, without re-installing and with the installation left in the magento folder.

    ############################################
    ## enable rewrites

    #RewriteLog c:\inetpub\iirfLogs\iirf
    #RewriteLogLevel 1
    #RewriteLogLevel 3

    Options +FollowSymLinks
    RewriteEngine on

    RewriteBase /magento/

    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
    ############################################## never rewrite for existing files, directories
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    ############################################## rewrite everything else to index.php
    RewriteRule .* index.php [L,U]

  12. Martijn says:

    Thanks a lot!

  13. Danny says:

    Worked like a charm :D epic!
    It was a bit scary to try, but I had no problems at all.

  14. chintan says:

    i installed a magento from web server to localhost
    it shows me the home page but when i try to access the other links it gives page not found error!!!
    and its working well on web server
    and i also found that when i add “index.php” in the url manually it opens the link
    does anyone know how to get rid of this????
    thank u in advance

  15. Joe says:

    Hey, I red a post of you about magento and htaccess. (http://www.bestdesigns.co.in/blog/remove-index-php-url-magento)
    I need to hide the /shop/ in url, but i can’t !
    http://jem-editions.ch/ -> redirect to -> http://jem-editions.ch/shop/

    I tried a lot of htaccess codes i found on the web, and your’s too, but no solution !! Do you have an idea ?

  16. Davalyn says:

    I’ve tried lots of others .htaccess but RISHIKESH VISPUTE is the BEST!.

    Thanks,

    D.

  17. Thanks so much! I’ve search everywhere, and this worked perfectly. You Rock!!!

  18. Mike.V says:

    THANK YOU
    THANK YOU
    THANK YOU
    THANK YOU
    THANK YOU
    THANK YOU

    I’ve been trying to work this out for hours to no avail. This is the only rewrite rule that worked for me.

    THANK YOU!

  19. Thanks for comments
    Rishikesh Vispute

  20. Thanks for comments
    Rishikesh Vispute
    Hoststop.co.uk


Page optimized by WP Minify WordPress Plugin

Optimized by SEO Ultimate