.htaccess rewrite works fine with number but not letters?

When I write www.example.com/foo/1 it works fine but when i write www.example.com/foo/count or any letter it says

Not Found

The requested URL foo/count was not found on this server.

but everthing works fine when I try foo/12 or any number is passed? whats wrong or what am I missing here?

RewriteEngine On
RewriteBase /
RewriteRule ^([^/]+)/(d+)/? $1.php?key=$1

Source: .htaccess

1 Comment

  1. Digin Dominic

    Try this :

    RewriteEngine On
    RewriteBase /
    RewriteRule ^([^/]+)/([^/]+)/? $1.php?key=$1 [NC,L]

    The pattern [^/]+ matchs any characters 1 or more times except the “/”.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.