...my .htaccess file which lives in the distributor folder
RewriteRule ^distributor/([0-9]+)$ distributor/index.php?id=$1
If the .htaccess
file is actually inside the /distributor
directory then you should not be referencing the distributor
directory in the RewriteRule
pattern. This matches against a URL-path that is relative to the directory that contains the .htaccess
file.
Likewise, you should not include the distributor
directory in a relative substitution string when inside the /distributor
directory. A relative substitution is again relative to the directory that contains the .htaccess
file.
Your existing .htaccess
file is written as if it was located in the document root directory, not the /distributor
subdirectory as stated.
However, you are also referencing both "distributor" and "distributer" in your examples - I assume the "e" is a typo, but this will obviously also result in a failed match.
And, as mentioned in @TeroKilkanen's answer, you are matching digits in your regex, not letters, as in your example URL.
So, your existing rule is matching a URL of the form /distributor/distributor/123
and rewriting to /distributor/distributor/index.php?id=123
.
Try the following instead, in the /distributor/.htaccess
file:
RewriteRule ^(\w+)$ index.php?id=$1 [L]
The \w
shorthand character class matches both digits and letters and is equivalent to the character class [0-9a-zA-Z_]
.