views:

29

answers:

2

Is it possible somehow using mod_rewrite change the url from http://www.mywebsite.com/company/123/reviews to http://www.mywebsite.com/company-123/reivews?

It's not a redirect. The problem is that the real path is the first one and I need my browser to display the second path. So when the user goes to company-123/reviews the content of the page is displayed from company/123/reviews.

Thank you.

A: 
RewriteRule ^/([a-z]*?)-([0-9]*?)/([a-z]*?)$ /$1/$2/$3

I think this will work, the regex does it's job atleast.

adamse
A: 

Use this rule to rewrite the former URL path to the latter one:

RewriteEngine on
RewriteRule ^([^/]+)-([0-9]+)/([^/]+)$ $1/$2/$3 [L]

But you already need the former URLs in your documents to get this rewriting work.

Gumbo