Simple mod-rewrite

Can mod-rewrite do this?

All urls pointing to ‘domain.com/1-xxx’ to use the page1.php page

All urls pointing to ‘domain.com/1-xxx/xxx-xxx’ to use the page2.php

All x values will relate to a number.

Thanks.

js,

Yes.

Aw, this is too simple not to answer with code!

RewriteEngine on
RewriteRule ^1-\\d{3}$ page1.php [L]
RewriteRule ^1-\\d{3}/\\d{3}-\\d{3}$ page2.php [L]

I’m sure that will fail any test except for those replacing each x with a digit. Are you really throwing away the values contained in the digits?

Oh, well, I’ll leave it to you to alter the number of digits required each time AND give a better specification if you need the values contained in the digits.

Regards,

DK