I need to create a htaccess 301 redirect that redirect all
www.mydomain.dk/40005/ (Where 40005 can be any 5 digit number) to www.mydomain.dk
Anyone know how to do that?
I need to create a htaccess 301 redirect that redirect all
www.mydomain.dk/40005/ (Where 40005 can be any 5 digit number) to www.mydomain.dk
Anyone know how to do that?
In your document root's htaccess file, or in your vhost config:
RedirectMatch 301 ^/[0-9]{5}/?$ /
ALternatively, you can also use mod_rewrite:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.dk$ [NC]
RewriteRule ^/?[0-9]{5}/?$ / [L,R=301]