0

This is a slight variation on the standard 'how to remove index.php from magento url' question.

I've implemented the changes mentioned in this answer and the urls generated on the site no longer show the index.php.

However, taking it a step further, old links to the site with index.php still in the url are still valid.

e.g. www.mydomain.com/index.php/page1 is mentioned somewhere online and user follows the link to the site. Instead of redirecting to www.mydomain.com/page1 it remains as it was and is still picked up in our analytics as a separate url.

I'm not familiar with the LAMP environment (still on the learning curve!), so I'm not used to mod_rewrite rules. Any help you can offer in educating me on how to structure the rule so that it strips the index.php from the url and 301 redirects to the remainder would be appreciated!

thanks!

Community
  • 1
  • 1
RoundTheBend
  • 41
  • 1
  • 1
  • 5

1 Answers1

0

You can redirect .index.php or other urls by .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>

this will only redirect www.website.com/index.php to www.website.com Also reindex data in index management in Magento Admin

  • That's great! Thanks! That solves one problem of redirecting index.php on the home page. I still need to find a way to strip out the index.php from the url, though. I did find a solution that looked like it would work (see below) but it broke the admin url which still requires it. `RedirectMatch 301 /index.php/(.*) http://www.example.com/$1` – RoundTheBend Jul 02 '15 at 15:45