2

How to remove index.php when we enter manually in the URL

My store path is /var/www/html/testfolder/

Thanks

3

5 Answers 5

3

Add this in your .htaccess after RewriteEngine on

RewriteCond %{THE_REQUEST} ^.*/index.php     
RewriteRule ^(.*)index.php$ https://domain.com/$1 [R=301,L]

Change domain.com to your domain and check do you use http or https. Its worked for me. When I enter address with index.php its redirecting to domain.

2
  • Updated , becuase was issue with different pages, now is fine.
    – BartZalas
    Commented Jul 5, 2018 at 10:24
  • yes working thankyou
    – Raghu
    Commented Jul 5, 2018 at 12:47
1

First, you have to make sure that Apache rewrites module is enabled on your server and then follow the below steps...

  1. Login to Magento admin account and go to this path - System > Configuration > General > Web.

  2. Select the yes for Use Web Server Rewrites in Search Engine Optimization (on Web settings).

  3. Now, Go to Magento root directory and add following code in .htaccess.

<IfModule mod_rewrite.c>

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

</IfModule>

0

It require enable mod_rewrite module

Use web server rewrite "Yes" from admin setting

Check refrence from here : How to remove index.php from your Magento site URL

1
  • thanks...it is there but when we enter manually index.php it should not show
    – Raghu
    Commented Jul 5, 2018 at 9:37
0

Try this :

remove index.php change in below path Override file in local and _updatePathUseRewrites comment line 599 and 606

app\code\local\Mage\Core\Model\Store.php
1
  • tried this now but same issue
    – Raghu
    Commented Jul 5, 2018 at 9:57
0

You can manage it through .htaccess file of your magento root directory. Add the following code to your .htaccess it should work.

RewriteEngine On
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.your-domain-name.com/$1 [R=301,L]
2
  • thanks this is not working and I have the path for magento /var/www/html/testfolder/
    – Raghu
    Commented Jul 5, 2018 at 10:13
  • Check the updated answer. Commented Jul 5, 2018 at 10:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.