On Magento the URL structure of a module will be like this:
example.com/[index.php]/:module/:controller/:action/:param1[/:paramN ...]
I created a gallery module. The gallery contains several album and the URL for each album is like this (following Magento URL structure):
example.com/[index.php]/gallery/controller/view/name/:album_name
but I want the url of each album on the gallery will be like this:
example.com/[index.php]/gallery/:album_name
How can I achieve this? I’ve tried with .htaccess Rewrite Rule but seems like I got it wrong and it’s not working. Here is my copy of Magento .htaccess rewrite rule
<IfModule mod_rewrite.c>
## enable rewrites
Options +FollowSymLinks
RewriteEngine on
## workaround for HTTP authorization
## in CGI environment
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
## Rewrite Rule for Gallery Module
RewriteRule ^/gallery/(.*)?$ /gallery/category/view/name/$1 [L]
## 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>
You could accomplish this using magento url rewrite in your confix.xml (without the need to use apache rewrite)
Read more @ do simple url rewrite in magento using config.xml
See my answer @ Magento Router Url – Need Hyphnated Path Name on how to access :album_name