Quick mod_rewrite Question... Limit Numbers

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Quick mod_rewrite Question... Limit Numbers

Post by tecktalkcm0391 »

I have this in my .htaccess file, but when you go to /12345/567/12/abc123 it doesn't send at 404, it should only work if it follows: 4numbers/2numbers/2numbers/2numbers/anything but it doesn't for the numbers parts... anyway to make sure its 4 or 2 digits any send 404 if it isn't in the format...

Thanks!

Code: Select all

Options +FollowSymLinks
RewriteEngine on
RewriteRule ([0-9]{4})/([0-9]{2})/([0-9]{2})/([0-9]{2})/([A-z0-9_.]+)$ index.php?year=$1&month=$2&week=$3&random=$4&filename=$5
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Re: Quick mod_rewrite Question... Limit Numbers

Post by tecktalkcm0391 »

They are all working except the very first one....I just discovered.... how can I get the first one with 4 digits to work...

Edit: Nevermind I got it... you have to use a ^ to start the Rule or it won't work...
Post Reply