Redirect static html to php

Took me a lot longer than I expected to find out how to do this. I was faced with the task of redirecting static html pages to php using htaccess. Problem was what to do about the query string in the php URLs. Apparently there’s a way to do it using mod_rewrite, but I didn’t have much luck going that route. Then I found www.rapidtables.com and voila!, their converter works! While probably not the preferred way to go about this, I just had to make redirects for each page which (thanks to Perl), didn’t take too long.

# Permanent URL redirect – generated by www.rapidtables.com
Redirect 301 /example-page1.html http://www.example.com/example.php?page=1

# Perl – redirect.pl
my @pages = (1 .. 83);

for my $i (@pages) {
print "Redirect 301 /example-page$i.html http://www.example.com/example.php?page=$i n";
}

Leave a Reply

Your email address will not be published. Required fields are marked *