views:

40

answers:

1

How can I 301 redirect any URL that starts with a number between 1 - 9999, for example

domain.com/12/something/anotherthing

domain.com/378/product/widgets

domain.com/2560

+1  A: 
RewriteCond %{REQUEST_URI} ^/([0-9]+)/?(.*)
RewriteRule (.*) http://domain.com

Should work but not tested, I could be braking some .htaccess rules here.

Adrian A.
I want it to match any url where the first segment is a number between 1 - 9999
Alex
@Adrian: This should be a comment, not an answer.
Mark Byers
@Mark Byers : I see no "Comment" button :)
Adrian A.
@Adrian: Ah yes, you need 50 rep to be able to comment.
Mark Byers
@Alex - do you want to use PHP or .htaccess ?
Adrian A.
trying to use .htaccess
Alex
Updated my first answer to be on the safe side, with an idea.
Adrian A.