1
 RewriteEngine on
 RewriteRule ^([a-zA-Z0-9]{1,3})\/([0-9])\.html$  thread.php?board=$1&thread=$2

Here is my .htaccess file. Let me explain you how it should work:

website.com/vg/1337.html => website.com/thread.php?board=vg&thread=1337

in the other words:

website.com/x/y.html => website.com/thread.php?board=x&thread=y
x - 1-3 symbols, A-z, 0-9;
y - unlimited amount of symbols, 0-9;

It does look pretty simple, but... website.com/vg/1337.html just leads me to 404.

What am I doing wrong?

1
  • What does the error_log say regarding that request? Commented Oct 2, 2011 at 21:23

3 Answers 3

4

Your regular expression only matches URLs that contain a single digit, for example "5.html".

To fix it change [0-9] to [0-9]+. The plus means "one or more of the previous token".

Sign up to request clarification or add additional context in comments.

Comments

1
[0-9]* or [0-9]+

missing enumerator after [0-9]. if you don't put anything, it would work for one char only

Comments

1

y is not "unlimited" in your example above, just allow one single digit. Add a star * after it (or a + for "1 or more").

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.