URL rewritten but still the original one also works and not redirecting

RewriteRule ^massaggi-([^/]*)$ /an.php?prov=$1 [L]

with a code like this I can see the links like this created

website.com/massaggi-city

But I can see that I can still access pages like

website.com/an.php?prov=city

I want to this (website.com/an.php?prov=city) to redirect to (website.com/massaggi-city)

Any help highly appreciated.

Ameerul,

I have EXACTLY the solution you’re looking for in the examples section of my signature’s tutorial. It’s not basic mod_rewrite code but there are a couple of ways to redirect to the OLD/SERVEABLE file from the NEW file format without looping. I believe it had also been in this board’s sticky posts but not sure that it’s still there these days. In other words, this is an OLD topic and a search of this forum may have dropped the solutions in your lap.

BTW, WELCOME to SitePoint!

Regards,

DK

Thanks I’ll look at it… Sometimes knowing what to search “the right keywords” is a challenge it self lol. By the way I’m not really new here. Maybe you confused my total post with mentioned post lol…

Aye, laddie, that I did!

Sorry about that … but you’re welcome here anyway (and I know I hadn’t greeted you before).

Regards,

DK