Case insensitive 301

I have about 300 redirects in the following format

Redirect 301 /post/My-Blog-Post.aspx https://www.example.com/blog/a-new-post/

This works fine, except that forwardings are case sensitive and the transition to is /post/my-blog-post.aspxnot redirected.

There is no template for the old URL for the new URL, so this is likely to be a flag for each redirect.

How can I redirect the url no matter?

+5
source share
2 answers

Do not think that you can make the directive Redirect(part of mod_alias) case insensitive, but there is a mod_rewrite flag that you can use. You will need to change all your redirects:

 Redirect 301 /post/My-Blog-Post.aspx https://www.example.com/blog/a-new-post/

at

 RewriteRule ^/?post/My-Blog-Post.aspx$ https://www.example.com/blog/a-new-post/ [L,R=301,NC]

NC, " ". URI, /post/my-blog-post.aspx , https://www.example.com/blog/a-new-post/.

+7

, "My-Blog-Post" "a-new-post", , , /post/My -Blog-Post.aspx /blog/a-new-post//post/ this.aspx /blog/ //post/that.aspx // , / /post/ anything.aspx /blog/ /, .htaccess :

Options +FollowSymlinks
RewriteEngine on

RewriteRule ^post/([a-z0-9-_]+).aspx$ /blog/$1/ [R=301,NC]
+1

All Articles