I've recently been trying to come up with a way of masking the visible URL in the browser (so not 301 redirecting) and still show the same content as the original URL.

Here is the scenario...

Current URL's are like:-


(parent-category and sub-category will always be the same word).

I wish to continue showing the content from those URL's but convert the URL's to show like:-


(keyword will always be the same word).

I'd really appreciate it if any experts on .htaccess could advise if this is possible please. It is a Magento store by the way.

The following has previously been suggested to me:-

RewriteRule ^parent-category/([^/]+)/filter/([^/]+)/?$ /$2-$1 [L,NC]

But this didn't have the desired affect... (Didn't change the visible URL in browser yet adding R, 301 redirects it though).

Specific Example

Current URL domain.com/showering/showers/filter/alliance

Required URL domain.com/alliance-showers

  • Can anyone assist with this at all?
    – zigojacko
    Mar 25, 2014 at 11:42
  • Your question is quite hard to understand. While I get the general problem you are having, you mix brand and keyword a lot and don't explain very well the end result you want to achieve..
    – ek9
    Mar 25, 2014 at 20:27

1 Answer 1


You define a rule backwards, so this is not working. The syntax is as following:

Syntax of RewriteRule

This would work, but will most likely break your magento (as all urls with a dash "-" in it will be rewritten):

RewriteRule ^/(.*)-(.*)$ /parent-category/sub-category/$2/$1 [L,NC]

So I would suggest putting it under some kind of static keyword, like "shop", so when you access domain.com/shop/brand-filter it will rewrite to /parent-category/sub-category/filter/brand:

RewriteRule ^/shop/(.*)-(.*)$ /parent-category/sub-category/$2/$1 [L,NC]

More information: http://httpd.apache.org/docs/current/rewrite/intro.html

The regular expressions (.*) mean one or more characters, where:

  • . (dot) means at least one character;
  • * (star) means zero or more characters;
  • Thanks for your answer. I've added a specific example to the question if that is easier to understand. I've tried your suggestion but the URL doesn't change. The URL just remains as domain.com/showering/showers/filter/alliance Thanks
    – zigojacko
    Mar 26, 2014 at 7:41

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.