Mobile app version of vmapp.org
Login or Join
Angela700

: Showing content from pages at different URL's (masking), possibly with .htaccess If I have URL's like:- domain.com/category/widgets/filter/blue domain.com/category/widgets/filter/red And it is pretty

@Angela700

Posted in: #Htaccess #Masking #Url #UrlRewriting

If I have URL's like:-

domain.com/category/widgets/filter/blue
domain.com/category/widgets/filter/red


And it is pretty difficult to reconstruct them to something like:-

domain.com/category/blue-widgets
domain.com/category/red-widgets


Is there any way at all that I can use URL rewrites or anything else with .htaccess or on the server to display the URL's as the domain.com/category/blue-widgets on the domain.com/category/widgets/filter/blue page?

I've looked into masking URL's but got nowhere and this has been something bugging me for almost 6 months now. Is there any way to achieve what I want to do?

FYI: This is a Magento website and the above process, I am wanting to implement for potentially hundreds of URL's.

Edit

To respond to @kkugelmann 's answer:-

I couldn't get your proposed RewriteRule to make a difference at all in the .htaccess file so I started testing a few things in this .htaccess tester:-

The proposed RewriteRule didn't work in this tester:-



However, the following did:-



But adding any of these RewriteRule's into the website's .htaccess file did not rewrite the URL at all...

Edit2

By the way, if I add [R=301,L] to the end of the URL rewrite rule, it does actually then rewrite the rule, but of course 301 redirects it as well which is unwanted behaviour.

Edit3

I found another question with the same issue... And an accepted answer that solved the problem which seemed to be something to do with using mod_proxy and the [P] tag on the rule (if I try this, the page 404's).

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Angela700

1 Comments

Sorted by latest first Latest Oldest Best

 

@Shelton105

You'll need mod_rewrite activated and your rewrite command should look like this:

RewriteEngine on
RewriteRule ^category/([a-zA-Z]*)-([a-zA-Z]*)$ category//filter/^


[Update]

RewriteEngine on
RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/filter/([a-zA-Z]+)$ /-

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme