| Posted: 16 May 2008 at 11:08am | IP Logged
|
|
|
Cobbling together examples I see ni this forum, I am about 98% done with everything I need, but this one little problem is killing me!
I have a CMS system that uses this URL pattern:
default.asp?contentID=xxx
where xxx is the ID of the page. I am converting the CMS to utilize SEO friendly URLs... so I created a map file with all of the friendly names and mapped them to the unique ID's.. like so:
mypage1.htm 12 mypage2.htm 24 mypagen.htm 36 (etc)
My mapfile is called redirs.txt.
So then I have this setup in my .htaccess file (ISAPI/Rewite 3, Licensed):
RewriteEngine On RewriteBase / RewriteMap lower int:tolower RewriteMap mapfile txt:redirs.txt RewriteRule ^/$ /default.asp [L] RewriteCond ${mapfile:${lower:$1}|NOT_FOUND} ^(?!NOT_FOUND)(.*)$ RewriteRule ^([^/]+)?$ ${mapfile:$1|$1} [R=301,L]
This works great when someone hits an old-style (unfriendly) URL like this:
http://www.mydomain.com/default.asp?contentid=24
It also works great when someone types:
http://www.mydomain.com/mypage2.htm
(redirects internally to the default.asp?contentID=24)
But what is screwed up is when someone just types:
http://www.mydomain.com/
I end up getting a fouled up at this point, either getting a weird long URL with all kinds of stuff like this:
http://www.mydomain.com/$%7Bmapfile:$%7Bmapfile:$%7Bmapfile:$%7Bmapfile:$%7Bmapfile:|%7D|$%7Bmapfile:|%7D%7D|$%7Bmapfile:$%7Bmapfile:|%7D|$%7Bmapfile:|%7D%7D%7D|$%7Bmapfile:$%7Bmapfile:$%7Bmapfile:|%7D
OR (if I keep tweaking it) I get various 404 errors, etc.
I'm sure it's something simple I'm missing... but it's killing me with the amount of time I'm spending trying to figure it out. Anybody out there understand what is going on here?
Thanks!
Edited by mshaffer - 16 May 2008 at 11:09am
|