# Mod Rewrite Puzzler

**URL:** <https://forum.kirupa.com/t/mod-rewrite-puzzler/284900>\
**Category:** programming\
**Created:** [March 24, 2009, 8:43pm UTC](https://forum.kirupa.com/t/mod-rewrite-puzzler/284900 "2009-03-24T20:43:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thedaveyb](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@thedaveyb](https://forum.kirupa.com/u/thedaveyb)\
**Post date:** [March 24, 2009, 8:43pm UTC](https://forum.kirupa.com/t/mod-rewrite-puzzler/284900/1 "2009-03-24T20:43:22Z")

</div>

Hi Guys, lets see if anyone can get their melons around this! (as i cant hehe)

Right were recently updated a site to integrate into an EPOS system, all is well except that the URL structure has changed. Now usually a 301 Redirect would do the trick but in this case the URLS are too similair and the old URLS (cached by google) are still being processed by the new URL rule…

OLD URL: menswear/b11-armani-jeans/  
NEW URL: menswear/armani-jeans

```auto

Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^menswear/?(.*)?$ store/product.php?g=menswear&p=$1 
redirect 301 /menswear/b11-armani-jeans/ http://www.tessuti.co.uk/menswear/armani-jeans

```

I have tried all manner of ordering the code but to no avail and also looked at rewriteCond…

```auto

rewritecond %{HTTP_HOST} ^www\.tessuti\.co.uk
rewritecond %{REQUEST_URI} !^/menswear/b11-armani-jeans/
RewriteRule ^(.*)$ http://www.tessuti.co.uk/menswear/armani-jeans [R=301,L] 

```

Any ideas?
