0

I've only started editing rewrite rules a few days ago, before now I'd copy and paste them for each case. I've written a rule which as far as I can tell*, should be matching but isn't

RewriteRule ^/store/(([A-Za-z]+)-Clocks+)/([A-Za-z0-9]+)\.asp($) /store/product/$3? [NC,R=301,L]`

I want this to be able to match domain.com/store/Alarm-Clocks/maf09r.asp and redirect to domain.com/store/product/maf09r/ All I can see in my error log is this:

[Fri May 31 12:08:17 2013] [error] [client IP] File does not exist: /home/user/store/Alarm-Clocks
[Fri May 31 12:09:18 2013] [error] [client IP] File does not exist: /home/user/store/Mantel-Clocks

where /home/user/ is the website root

Is there anything glaringly obvious which I've done wrong?

*I've tested with both this and this

Jamie Taylor
  • 362
  • 1
  • 6
  • 15
  • Isn't the group you want to match `$3` not `$4` ? – NickW May 31 '13 at 11:26
  • My mistake, that's still in from when I was trying to get it working, the error is still the same though, I'll edit that now – Jamie Taylor May 31 '13 at 11:26
  • also, what does ($) match against, if you want the end of the line, $ should be fine by itself.. – NickW May 31 '13 at 11:29
  • it should be matching the `([A-Za-z0-9]+)` part before .asp but with my severe lack of knowledge, it may not be doing that - Edit, sorry, I misread the question, I've only modified this line by piecing together other rules and trying to learn from them – Jamie Taylor May 31 '13 at 11:31
  • It would be matching, uh.. dunno. if you just want to match .asp at the end of the line `\.asp$` – NickW May 31 '13 at 11:35
  • Do you have `RewriteEngine on` in your config before this rule and is this rule inside a `` block or a `.htaccess` file? – Ladadadada May 31 '13 at 23:18

0 Answers0