Best way to redirect legacy URLs with Rewrite Map?

subBlue

Active Member
#1
I am updating a site where the new version will have slightly different URLs for the main sections. I want to use Rewrite Map to create a text file with a list of rules that will point some of the key old addresses to the new URLs.

I've created a url map file which contains source/target URLs like:
Code:
news.asp news
showcase.asp showcase
info.asp about_us/information
I've saved this as a text file and added it to the Rewrite Map dialogue as:
name: legacy
location: txt:/var/www/vhosts/mysite.com/rewrite.txt

In the rewrite field I then have:
Code:
RewriteRule ^(.*)$ ${legacy:$1} [R=301]
However, I'm finding that Firefox pops up and says that I'm redirecting in a way that will never complete.
Any suggestions on what is going wrong here?
 

mistwang

LiteSpeed Staff
#2
Rewrite map is not a right solution for what you want exactly. As the rewrite rule will match all URL no matter it is in the rewrite map file or not. You have to use individual rewrite rule to handle different mapping, may be for mapping info.asp -> about_us/information, another generic one to strip ".asp" off the URL.
 
Top