Using AI to Write Redirects

Using AI to Write Redirects

One of the main things I hope to do when writing for iBizDaily is to provide concrete, real world examples of the tools I use to get things done every day. As most people working in the web space are probably aware, AI tools and applications have been exploding in popularity and actual usefullness of late.

I recently used OpenAI's ChatGPT (which is as of this writing in a free beta) to write a server redirect for a Windows server. I am well versed in most of this stuff but definitely a Linux person, so using this solution was hopefully going to do a few things for me:

  1. Save time
  2. Help in an environment I am not too familiar with
  3. Get it right the first time

It came through on all three fronts - basically (I had to ask twice as my first question wasn't quite tight enough):

Using AI to Write Redirects
Screenshot from

In the chat window, I wrote:

write a redirect for an IIS server that can be put into an htaccess file that takes all traffic to and sends it to

And the answer that came out was:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^$ [NC]
RewriteRule ^(.*)$$1 [L,R=301]

I added this to an .htaccess file, uploaded it to the clients server, and voila - it works. All traffic coming in for (http or https) gets forwared to - which was our goal.

All three of my conditions were met - and the main one - saving time - was blown away. Without this tool I would have first had to Google the use case, then visit a bunch of pages (without maybe ever finding exactly what I needed), try them out via trial and error, etc. With what ChatGPT gave me I was pretty confident with my limited knowledge of redirects that it would work, and it did - problem solved, time saved, customer relieved (this was actually done so quickly that the client was on the phone with me the whole time).

I don't know how long this specific tool will be free, but at the moment I highly recommened anyone working on websites check it out and give it a try - there are many other use cases where it can help.

UPDATE: I forgot a condition when I originally did this - I only asked for urls with the www sub-domain - the proper question should have been for both conditions: Write a redirect for an IIS server that can be put into the htaccess file that takes all traffic to and and sends it to

The answer is then changed to:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www.)?$ [NC]
RewriteRule ^(.*)$$1 [R=301,L]