.htaccess for Magento pretty URLs

I was pulling my hair out over this because Magento failed to produce an .htaccess file after I enabled url rewrites on my local dev server. I searched the old internets and found nothing! I ended up using the same .htaccess arguments as I do for WordPress and it worked great.

To enable url rewrites, go to System > Configuration > Web > Search Engines Optimization > Use Web Server Rewrites and choose yes.

Copy the following into a blank file and save it in the root of your Magento install as “.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 entry was posted in Musings. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>