Search code examples
regexapachehttphttp-redirecthttp-status-code-301

What's the proper redirect rule (to avoid redirect loop)


I want to redirect a broken filename 'artist_-title' to 'artist-_title.zip'. I tried this in .htaccess:

RedirectMatch 301 artist_-_title artist_-_title.zip

I think I do understand what causes the loop, but I don't know much about regular expressions.


Solution

  • You should write something like this:

    RedirectMatch 301 artist_-_title$ artist_-_title.zip