This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: Rewriting with a map file and database
Author
Message |
k00k
Newbie


Joined: 24 September 2011
Posts: 2
Posted: 24 September 2011 at 12:12pm

I am trying to use an MSSQL database to generate search engine friendly URLs via a map-file.

Code:
DBDriver mssql
DBDParams "Data Source=mssql.myserver.com;Initial Catalog=database;User ID=username;Password=password"
DBDPrepareSQL "SELECT RTRIM(word) AS word FROM dbo.words WHERE (word_id = @KEY)" seo_map_select

RewriteEngine on
LogLevel debug
RewriteLogLevel 9

RewriteMap map_dbd dbd:seo_map_select

RewriteCond %{QUERY_STRING} word_id=(\d+) [NC]
RewriteCond ${map_dbd:%1|NOT_FOUND} (.*)
RewriteCond %2 !NOT_FOUND
RewriteRule ^word\.asp$ /%2? [NC,R=301,L]

The above unfortunately doesn't work.

The URL:

Code:
http://mydomain.com/word.asp?word_id=9999


I would like:

Code:
http://mydomain.com/result-from-database


..and vice versa:

Code:
/someword     -->     /word.asp?word_id=9999
    

--
Can anyone help me?

Thanks!
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 26 September 2011 at 9:51am

Hello,

Please, try using:

Code:
RewriteEngine on
RewriuteBase /

RewriteCond %{QUERY_STRING} word_id=(\d+) [NC]
RewriteCond ${map_dbd:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^word\.asp$ ${map_dbd:%1}? [NC,R=301,L]


Also, please, provide the example from mapfile itself.

Regards
Andrew

Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version