Reputation: 123
I recently setup a magento store and the URL is mydomain.com/index.php/admin or mydomain.com/index.php/about-us. I'd like to remove the index.php and I googled methods on how to and I found this code should work, but it does not:
<IfModule mod_rewrite.c>
############################################
## enable rewrites
Options +FollowSymLinks
RewriteEngine on
############################################
## you can put here your magento root folder
## path relative to web root
RewriteBase /
############################################
## workaround for HTTP authorization
## in CGI environment
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
############################################
## always send 404 on missing files in these folders
RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
############################################
## never rewrite for existing files, directories and links
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
############################################
## rewrite everything else to index.php
RewriteRule .* index.php [L]
</IfModule>
Thanks.
Upvotes: 2
Views: 6465
Reputation: 358
Go to Magento Back end.
Navigate to System > Configuration then Web in left hand side sidebar.
Now chose Use Web Server Rewrites to Yes
Clear the Cache.
Done
Upvotes: 0
Reputation: 456
Looks like you have given wrong relative path of your Magento root folder:
## you can put here your magento root folder
## path relative to web root
RewriteBase /
Upvotes: 1
Reputation: 21
You really should use the second method and let Magento force the rewrite rule. Its the cleanest way. It will do exactly that, remove index.php from the url in all cases.
Upvotes: 1
Reputation: 7525
What you have to make sure first, is that, in Apache, (If that's what you are using) to enable Mod Rewrites
... THEN you can add the following to your .htaccess
file.
To enable Mod Rewrites
:
sudo a2enmod
From SSH command line (or talk to your host)
.htaccess:
RewriteEngine on
RewriteRule .* index.php [L]
Upvotes: 1