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.
| SitePoint Sponsor |


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!
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?Code:RewriteEngine on RewriteRule ^1-\d{3}$ page1.php [L] RewriteRule ^1-\d{3}/\d{3}-\d{3}$ page2.php [L]
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
David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
Updated mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator
Bookmarks