301 redirect issue in IIS web server

Avatar
  • Answered
Hi, I am trying to implement a 301 permanent redirect rule via .htaccess file. However, the website is throwing an error like "Redirect too many times." Below is my .htaccess file code. I generated this with an htaccess redirect generator. Options +FollowSymlinks

RewriteEngine on rewriterule ^en/contact-us(.*)$ https://iwww.millerfallprotection.com/en/contact-us$1 [r=301,nc] After that, I imported this file through IIS. But when browsing the page, I get an error. https://iwww.millerfallprotection.com/en/contact-us got an error, but status code showing 301 redirect. "error:iwww.millerfallprotection.com redirected you too many times." "Try clearing your cookies." "ERR_TOO_MANY_REDIRECTS" Can you help me, please? Thanks
Avatar
CaseyB
Hello [email protected], Thank you for your question about your 301 redirect. The reason that you're seeing this error is that your rewrite rule 'search term' matches the URL that you rewrite to. Thus, your web server keeps matching the redirect. I would recommend adding a line similar to "RewriteCond %{ENV:REDIRECT_STATUS} !200" above your rewrite rule, or consulting with an experienced web developer for other options. Please also keep in mind that our servers do not use IIS, and this suggestion may not apply for that software. Gratefully, Casey B.