Question

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

Was it helpful?

Solution

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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow