I was wondering if there is a way I can distinguish between letters and numbers. For example I have RewriteRule ^the-directory/(.*)/(.*)$ index.php?app=the-directory-cat&id=$1&l=$2 [L] How can I split this up so I can have... RewriteRule ^the-directory/(.*)/(LETTERS)$ index.php?app=the-directory-cat&id=$1&l=$2 [L] RewriteRule ^the-directory/(.*)/(NUMBERS)$ index.php?app=A-directory&id=$1&l=$2 [L] So basically letters will go to a different page and numbers will go to a different page? Thanks!
Shoot... i'm not sure that you can do that with mod-rewrite. You could rewrite it to a different php page that would include one of two files based on whether it had letters or numbers.
Would it work doing something like RewriteRule ^the-directory/(.*)/([\d]+)$ index.php?app=the-directory-cat&id=$1&l=$2 [L] RewriteRule ^the-directory/(.*)/([\D]+)$ index.php?app=A-directory&id=$1&l=$2 [L] I have this setup now but I don't see anything happening or working.
I don't think you can use those kinds of Perl reg-ex codes, but something like this should work: RewriteRule ^the\-directory/(.*)/([0-9]+)/?$ /index.php?app=the-directory-cat&id=$1&l=$2 [L] RewriteRule ^the\-directory/(.*)/([a-zA-Z]+)/?$ /index.php?app=A-directory&id=$1&l=$2 [L] Code (markup): That would catch URLs such as these: www.example.com/the-directory/xxx/123 www.example.com/the-directory/xxx/ABC ...and pass the xxx as id= and the numbers or letters as l= To make things more complete: - Added a "\-" as "-" is kindof reserved in reg-ex although sometimes it seems to work fine, but other times won't catch a hyphen. Of course if this is just an example then ignore that. - Added a "/?" which says this might contain an ending slash on the directory as you can never be sure how people will link to it. - Added a / before index.php just so it knows to run the one in site root. You might not of course want that depending where the file is actually located. If that still doesn't work, can you give us an example of what the URL will look like that's trying to call this? Trev