1

Hi I'm not that great at regex and have been tasked with cleaning up a line by line .htaccess file. I've read that RewriteMap is a good alternative to avoid a messy .htaccess file, but I've really got no idea where to start. Most guides seem to require prerequisite knowledge that I do not have. Can anyone help me?

1 Answers1

0

I use ISAPI Rewrite III for Windows IIS, so it may not be exactly the same as php, but if not at least its very close. This is what I use:

RewriteEngine on
RewriteBase /
RewriteMap artMap txt:d:/inetpub/pathToMapDirectory/artMap.txt [NC]
RewriteRule ^Frequency-Machine/(.*) ${artMap:$1} [NC]

"Frequency-Machine" can be any text string that you want to use to trigger the rewrite map operation. I use a different string for each site that I do.

Here is a sample of the map file:

The-Analog-vs.-Digital-Frequency-Debate      content1.asp?id=47&catID=1
The-GB4000-Frequency-Generator      content1.asp?id=12&catID=1
Video-Tutorial-Flash      content1.asp?id=58&catID=1
GB400-Frequently-Asked-Questions      content1.asp?id=49&catID=3

Hope that helps.

user3285097
  • 171
  • 1
  • 4