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: 2 rewrite rules. 1 works, 2nd doesn’t
Author
Message |
elvy1973
Newbie


Joined: 12 October 2010
Posts: 19
Posted: 01 August 2011 at 11:32am

Hello

I have the following 2 rules using mapfiles


---------HTACCESS ------------

RewriteBase /

#RULE ONE SUBCATEGORIES - THISONE WORKS
RewriteMap mapfile txt:_mapfile-subcats.txt
RewriteMap revmapfile txt:_revmapfile-subcats.txt
 
RewriteCond %{QUERY_STRING} ^sC_ID=(.*)$ [NC]
RewriteRule ^business-listings-s\.asp$ /${mapfile:%1}.html? [NC,R=301,L]
RewriteRule ^([^/]+)\.html$ business-listings-s.asp?sC_ID=${revmapfile:$1} [NC,L]


#RULE TWO CATEGORIES - THIS ONE DOES NOT WORK
RewriteMap mapfile2 txt:_mapfile-cats.txt
RewriteMap revmapfile2 txt:_revmapfile-cats.txt

#RewriteCond %{QUERY_STRING} ^C_ID=(.*)$ [NC] 
#RewriteRule ^business-listings-c\.asp$ /${mapfile2:%1}.html? [NC,R=301,L]
#RewriteRule ^([^/]+)\.html$ business-listings-c.asp?C_ID=${revmapfile2:$1} [NC,L]


---------END HTACCESS ------------


Sample working link - redirects to a seo friendly link


http://www.naastown.com/business-listings-s.asp?sC_ID=1

redirects to

http://www.naastown.com/bed-and-breakfast-in-naas-kildare.html


For some reason the second rule does not work - it is almost identical except that the querystring parameter is C_ID and page file name is business-listings-c.asp.  I have it turned off at present but when I had it turned on the link such as http://www.naastown.com/business-listings-c.asp?C_ID=2  just redirect to the site homepage.

Map files and .htacess are in same root folder.

Any Help would be greatly appreciated



Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 02 August 2011 at 8:06am

Please, provide the rewrite.log for the testing request.
Logging issues are described in FAQ

Regards
Andrew
Back to Top
 
elvy1973
Newbie


Joined: 12 October 2010
Posts: 19
Posted: 02 August 2011 at 11:23am

Here are the log files i just got from my shared host... Although I have the second rule (not working) commented out in the .HTACCESS file. I am  a newbie to .htacess so sorry I can't make head nor tail of this


83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15100648/initial] (2) init rewrite engine with requested uri /business-listings-c.asp?C_ID=2
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15100648/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15100648/initial] (1) Htaccess process request c:\domains\naastown.com\wwwroot\.htaccess
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15100648/initial] (3) applying pattern '.?' to uri 'business-listings-c.asp'
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15100648/initial] (4) RewriteCond: input='off' pattern='(on)?' => matched
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15100648/initial] (4) RewriteCond: input='www.naastown.com' pattern='^(?!www\.)(.+)$' => not-matched
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15100648/initial] (3) applying pattern '^index\.asp$' to uri 'business-listings-c.asp'
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15100648/initial] (3) applying pattern '^business-listings-s\.asp$' to uri 'business-listings-c.asp'
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15100648/initial] (3) applying pattern '^([^/]+)\.html$' to uri 'business-listings-c.asp'
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15103312/initial] (2) init rewrite engine with requested uri /img_library/products/standard/SKI-interiors-logo-T.jpg
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15103312/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15103312/initial] (1) Htaccess process request c:\domains\naastown.com\wwwroot\.htaccess
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15103312/initial] (3) applying pattern '.?' to uri 'img_library/products/standard/SKI-interiors-logo-T.jpg'
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15103312/initial] (4) RewriteCond: input='off' pattern='(on)?' => matched
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15103312/initial] (4) RewriteCond: input='www.naastown.com' pattern='^(?!www\.)(.+)$' => not-matched
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15103312/initial] (3) applying pattern '^index\.asp$' to uri 'img_library/products/standard/SKI-interiors-logo-T.jpg'
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15103312/initial] (3) applying pattern '^business-listings-s\.asp$' to uri 'img_library/products/standard/SKI-interiors-logo-T.jpg'
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15103312/initial] (3) applying pattern '^([^/]+)\.html$' to uri 'img_library/products/standard/SKI-interiors-logo-T.jpg'
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15124328/initial] (2) init rewrite engine with requested uri /img_library/products/standard/mccormack-furniture-naas-T.jpg
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15124328/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15124328/initial] (1) Htaccess process request c:\domains\naastown.com\wwwroot\.htaccess
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15124328/initial] (3) applying pattern '.?' to uri 'img_library/products/standard/mccormack-furniture-naas-T.jpg'
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15124328/initial] (4) RewriteCond: input='off' pattern='(on)?' => matched
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15124328/initial] (4) RewriteCond: input='www.naastown.com' pattern='^(?!www\.)(.+)$' => not-matched
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15124328/initial] (3) applying pattern '^index\.asp$' to uri 'img_library/products/standard/mccormack-furniture-naas-T.jpg'
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15124328/initial] (3) applying pattern '^business-listings-s\.asp$' to uri 'img_library/products/standard/mccormack-furniture-naas-T.jpg'
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15124328/initial] (3) applying pattern '^([^/]+)\.html$' to uri 'img_library/products/standard/mccormack-furniture-naas-T.jpg'
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15098576/initial] (2) init rewrite engine with requested uri /img_library/products/standard/kildare-leisure-logo.gif
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15098576/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15098576/initial] (1) Htaccess process request c:\domains\naastown.com\wwwroot\.htaccess
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15098576/initial] (3) applying pattern '.?' to uri 'img_library/products/standard/kildare-leisure-logo.gif'
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15098576/initial] (4) RewriteCond: input='off' pattern='(on)?' => matched
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15098576/initial] (4) RewriteCond: input='www.naastown.com' pattern='^(?!www\.)(.+)$' => not-matched
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15098576/initial] (3) applying pattern '^index\.asp$' to uri 'img_library/products/standard/kildare-leisure-logo.gif'
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15098576/initial] (3) applying pattern '^business-listings-s\.asp$' to uri 'img_library/products/standard/kildare-leisure-logo.gif'
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15098576/initial] (3) applying pattern '^([^/]+)\.html$' to uri 'img_library/products/standard/kildare-leisure-logo.gif'
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15161920/initial] (2) init rewrite engine with requested uri /img_library/products/standard/shylocks-hair-salon-naas-T.jpg
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15161920/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15161920/initial] (1) Htaccess process request c:\domains\naastown.com\wwwroot\.htaccess
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15161920/initial] (3) applying pattern '.?' to uri 'img_library/products/standard/shylocks-hair-salon-naas-T.jpg'
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15161920/initial] (4) RewriteCond: input='off' pattern='(on)?' => matched
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15161920/initial] (4) RewriteCond: input='www.naastown.com' pattern='^(?!www\.)(.+)$' => not-matched
83.138.8.102 83.138.8.102  Tue, 02-Aug-2011  17:16:09 GMT [www.naastown.com/sid#9957][rid#15161920/initial] (3) applying pattern '^index\.asp$' to uri 'img_library/products/standard/shylocks-hair-salon-naas-T.jpg'
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 04 August 2011 at 4:42am

Please, uncomment that rule and make a new log like this one.
We can't figure out the issue with the rule without the rule itdelf being involved.

Regards
Andrew
Back to Top
 
elvy1973
Newbie


Joined: 12 October 2010
Posts: 19
Posted: 10 August 2011 at 4:18am

Hello Andrew. I have applied the .HTACESS rules to another site which I am currently developing with all rules running.



------------------START HTACCESS----------------
RewriteEngine on

# Redirecting non-www version to www
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]

 
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.asp\ HTTP/
RewriteRule ^index\.asp$ http://www.newbridgetown.com/ [R=301,L]

RewriteBase /

#RULE ONE SUBCATEGORIES
RewriteMap mapfile txt:_mapfile-subcats.txt
RewriteMap revmapfile txt:_revmapfile-subcats.txt
 
RewriteCond %{QUERY_STRING} ^sC_ID=(.*)$ [NC]
RewriteRule ^business-listings-s\.asp$ /${mapfile:%1}.html? [NC,R=301,L]
RewriteRule ^([^/]+)\.html$ business-listings-s.asp?sC_ID=${revmapfile:$1} [NC,L]


#RULE TWO CATEGORIES  NOT WORKING AT MINUTE
RewriteMap mapfile2 txt:_mapfile-cats.txt
RewriteMap revmapfile2 txt:_revmapfile-cats.txt

RewriteCond %{QUERY_STRING} ^C_ID=(.*)$ [NC] 
RewriteRule ^business-listings-c\.asp$ /${mapfile2:%1}.html? [NC,R=301,L]
RewriteRule ^([^/]+)\.html$ business-listings-c.asp?C_ID=${revmapfile2:$1} [NC,L]

----------------------------END HTACCESS-------------------------




Here is a sample link which works for rule 1. (subcategories)




Here is a sample link which does not work for rule 2 (categories) - although rule formats are identical except that they  just have different querystring parameters and filenames.





Here are links to mapfiles
http://www.newbridgetown.com/_mapfile-subcats.txt (works)
http://www.newbridgetown.com/_revmapfile-subcats.txt (works)
http://www.newbridgetown.com/_mapfile-cats.txt  (not working)
http://www.newbridgetown.com/_revmapfile-cats.txt (not working)
  



I am on a shared host so not that easy to get my hands on error logs etc

Hope you can help
Back to Top
 
elvy1973
Newbie


Joined: 12 October 2010
Posts: 19
Posted: 10 August 2011 at 7:21am

apologies left out the live sample links above

Here is a sample link which works for rule 1. (subcategories)
http://www.newbridgetown.com/business-listings-s.asp?sC_ID=2



Here is a sample link which does not work for rule 2 (categories) - although rule formats are identical except that they  just have different querystring parameters and filenames.
http://www.newbridgetown.com/business-listings-c.asp?C_ID=1

Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 11 August 2011 at 5:28am

Please, provide the rewrite.log for the requests.

Regards
Andrew
Back to Top
 
elvy1973
Newbie


Joined: 12 October 2010
Posts: 19
Posted: 18 August 2011 at 11:04am

Hi Andrew. Below is the rewrite.log i just got from my shared host. The issue is at present the rule with the ID parameter of C_ID does not go to a page which should display database records from that category and a friendly url in the address bar Instead it just goes to the website home page.Hoping that we can get it to read out records friendly urls as in the first rule (which uses parameter sC_ID)




---------------------------------------------


83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:50 GMT [www.newbridgetown.com/sid#9207][rid#19288736/initial] (2) init rewrite engine with requested uri /accommodation-in-newbridge.html

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:50 GMT [www.newbridgetown.com/sid#9207][rid#19288736/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:50 GMT [www.newbridgetown.com/sid#9207][rid#19288736/initial] (1) Htaccess process request d:\domains\newbridgetown.com\wwwroot\.htaccess

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:50 GMT [www.newbridgetown.com/sid#9207][rid#19288736/initial] (3) applying pattern '.?' to uri 'accommodation-in-newbridge.html'

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:50 GMT [www.newbridgetown.com/sid#9207][rid#19288736/initial] (4) RewriteCond: input='off' pattern='(on)?' => matched

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:50 GMT [www.newbridgetown.com/sid#9207][rid#19288736/initial] (4) RewriteCond: input='www.newbridgetown.com' pattern='^(?!www\.)(.+)$' => not-matched

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:50 GMT [www.newbridgetown.com/sid#9207][rid#19288736/initial] (3) applying pattern '^index\.asp$' to uri 'accommodation-in-newbridge.html'

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:50 GMT [www.newbridgetown.com/sid#9207][rid#19288736/initial] (3) applying pattern '^business-listings-s\.asp$' to uri 'accommodation-in-newbridge.html'

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:50 GMT [www.newbridgetown.com/sid#9207][rid#19288736/initial] (3) applying pattern '^([^/]+)\.html$' to uri 'accommodation-in-newbridge.html'

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:50 GMT [www.newbridgetown.com/sid#9207][rid#19288736/initial] (5) map lookup FAILED: map=revmapfile[txt] key=accommodation-in-newbridge

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:50 GMT [www.newbridgetown.com/sid#9207][rid#19288736/initial] (1) Rewrite URL to >> /business-listings-s.asp?sC_ID=

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:50 GMT [www.newbridgetown.com/sid#9207][rid#19288736/initial] (2) rewrite 'accommodation-in-newbridge.html' -> '/business-listings-s.asp?sC_ID='

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:50 GMT [www.newbridgetown.com/sid#9207][rid#19288736/initial] (2) internal redirect with /business-listings-s.asp?sC_ID= [INTERNAL REDIRECT]

----

http://www.newbridgetown.com/business-listings-c.asp?C_ID=1

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:51 GMT [www.newbridgetown.com/sid#9207][rid#19291992/initial] (2) init rewrite engine with requested uri /

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:51 GMT [www.newbridgetown.com/sid#9207][rid#19291992/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:51 GMT [www.newbridgetown.com/sid#9207][rid#19291992/initial] (1) Htaccess process request d:\domains\newbridgetown.com\wwwroot\.htaccess

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:51 GMT [www.newbridgetown.com/sid#9207][rid#19291992/initial] (3) applying pattern '.?' to uri ''

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:51 GMT [www.newbridgetown.com/sid#9207][rid#19291992/initial] (4) RewriteCond: input='off' pattern='(on)?' => matched

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:51 GMT [www.newbridgetown.com/sid#9207][rid#19291992/initial] (4) RewriteCond: input='www.newbridgetown.com' pattern='^(?!www\.)(.+)$' => not-matched

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:51 GMT [www.newbridgetown.com/sid#9207][rid#19291992/initial] (3) applying pattern '^index\.asp$' to uri ''

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:51 GMT [www.newbridgetown.com/sid#9207][rid#19291992/initial] (3) applying pattern '^business-listings-s\.asp$' to uri ''

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:51 GMT [www.newbridgetown.com/sid#9207][rid#19291992/initial] (3) applying pattern '^([^/]+)\.html$' to uri ''

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:51 GMT [www.newbridgetown.com/sid#9207][rid#19291992/initial] (3) applying pattern '^business-listings-c\.asp$' to uri ''

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:51 GMT [www.newbridgetown.com/sid#9207][rid#19291992/initial] (3) applying pattern '^([^/]+)\.html$' to uri ''

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:51 GMT [www.newbridgetown.com/sid#9207][rid#19291992/initial] (3) applying pattern '(.+)' to uri ''

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:51 GMT [www.newbridgetown.com/sid#9207][rid#19291992/initial] (3) applying pattern '^([^/]+)\.html$' to uri ''

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:51 GMT [www.newbridgetown.com/sid#9207][rid#19291992/initial] (3) applying pattern '(.+)' to uri ''

83.138.8.102 83.138.8.102 Thu, 18-Aug-2011 16:28:51 GMT [www.newbridgetown.com/sid#9207][rid#19291992/initial] (3) applying pattern '^([^/]+)\.html$' to uri ''



-----------------------------------------------------

Thank you
Back to Top
 
elvy1973
Newbie


Joined: 12 October 2010
Posts: 19
Posted: 22 August 2011 at 5:19am

Hello Andrew  - I posted that log file - any update for me please
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 22 August 2011 at 7:13am

You've provided the following request, that shows us, that entry "accommodation-in-newbridge.html" hasn't been found in mapfile.

Quote:
http://www.newbridgetown.com/business-listings-s.asp?sC_ID=2

(2) init rewrite engine with requested uri /accommodation-in-newbridge.html
(3) applying pattern '^([^/]+)\.html$' to uri 'accommodation-in-newbridge.html'
(5) map lookup FAILED: map=revmapfile[txt] key=accommodation-in-newbridge
(1) Rewrite URL to >> /business-listings-s.asp?sC_ID=
(2) rewrite 'accommodation-in-newbridge.html' -> '/business-listings-s.asp?sC_ID='
(2) internal redirect with /business-listings-s.asp?sC_ID= [INTERNAL REDIRECT]


Request to the root of the site does not say anything to us. I think the whole issue with ISAPI_Rewrite rules lies here:

Quote:
The issue is at present the rule with the ID parameter of C_ID does not go to a page which should display database records from that category and a friendly url
in the address bar Instead it just goes to the website home page.Hoping that we can get it to read out records friendly urls as in the first rule (which uses parameter
sC_ID)

Back to Top
 
elvy1973
Newbie


Joined: 12 October 2010
Posts: 19
Posted: 24 August 2011 at 10:04am

Hi Andrew

I have the  listing(1 accommodation-in-newbridge) in the mapfiles which are assocatied with the rule that doesn't work.  where 1 is the C_ID been passed from database.

Here are links to mapfiles
http://www.newbridgetown.com/_mapfile-cats.txt  (not working C_ID rule)
http://www.newbridgetown.com/_revmapfile-cats.txt (not working C_ID rule)

http://www.newbridgetown.com/_mapfile-subcats.txt (works - sC_ID rule)
http://www.newbridgetown.com/_revmapfile-subcats.txt (works - sC_ID rule)


I am just stumped as both the rules are of identical format in the .htaccess file as below. One works and one doesn't. The only difference is the referring URL and its ID name

Example .htaccess WORKING RULE

#RULE SUBCATEGORIES
RewriteMap mapfile txt:_mapfile-subcats.txt
RewriteMap revmapfile txt:_revmapfile-subcats.txt

RewriteCond %{QUERY_STRING} ^sC_ID=(.*)$ [NC]
RewriteRule ^business-listings-s\.asp$ /${mapfile:%1}.html? [NC,R=301,L]
RewriteRule ^([^/]+)\.html$ business-listings-s.asp?sC_ID=${revmapfile:$1} [NC,L]



link:   http://www.newbridgetown.com/business-listings-s.asp?sC_ID=11

redirects to

http://www.newbridgetown.com/ladies-fashions-and-clothes-shops-in-newbridge.html




Example .htaccess NOT WORKING RULE
link: http://www.newbridgetown.com/business-listings-c.asp?C_ID=1
(just redirects to homepage) when it should goto www.newbridgetown.com/accommodation-in-newbridge.html



#RULE  CATEGORIES
RewriteMap mapfile2 txt:_mapfile-cats.txt
RewriteMap revmapfile2 txt:_revmapfile-cats.txt


RewriteCond %{QUERY_STRING} ^C_ID=(.*)$ [NC] 
RewriteRule ^business-listings-c\.asp$ /${mapfile2:%1}.html? [NC,R=301,L]
RewriteRule ^([^/]+)\.html$ business-listings-c.asp?C_ID=${revmapfile2:$1} [NC,L]


Hope you can help

Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 26 August 2011 at 8:09am

There's nothing I can tell without a log for this particular request.
http://www.newbridgetown.com/business-listings-c.asp?C_ID=1

ISAPI_Rewrite is the first to catch the request, so there must be something referring to it.

Regards
Andrew
Back to Top
 
elvy1973
Newbie


Joined: 12 October 2010
Posts: 19
Posted: 29 August 2011 at 6:24am

Hello Andrew

Here is the  .htaccess


RewriteBase /

#RULE ONE SUBCATEGORIES
RewriteMap mapfile txt:_mapfile-subcats.txt
RewriteMap revmapfile txt:_revmapfile-subcats.txt

#RULE TWO CATEGORIES
RewriteMap mapfile2 txt:_mapfile-cats.txt
RewriteMap revmapfile2 txt:_revmapfile-cats.txt


 
RewriteCond %{QUERY_STRING} ^sC_ID=(.*)$ [NC]
RewriteRule ^business-listings-s\.asp$ /${mapfile:%1}.html? [NC,R=301,L]
RewriteRule ^([^/]+)\.html$ business-listings-s.asp?sC_ID=${revmapfile:$1} [NC,L]


RewriteCond %{QUERY_STRING} ^C_ID=(.*)$ [NC] 
RewriteRule ^business-listings-c\.asp$ /${mapfile2:%1}.html? [NC,R=301,L]
RewriteRule ^([^/]+)\.html$ business-listings-c.asp?C_ID=${revmapfile2:$1} [NC,L]


---------------------------------------------

If I comment out the first Rewrite Condiiton:::
RewriteCond %{QUERY_STRING} ^sC_ID=(.*)$ [NC]
RewriteRule ^business-listings-s\.asp$ /${mapfile:%1}.html? [NC,R=301,L]
RewriteRule ^([^/]+)\.html$ business-listings-s.asp?sC_ID=${revmapfile:$1} [NC,L]


Then

The second rewrite condition works for me..

RewriteCond %{QUERY_STRING} ^C_ID=(.*)$ [NC] 
RewriteRule ^business-listings-c\.asp$ /${mapfile2:%1}.html? [NC,R=301,L]
RewriteRule ^([^/]+)\.html$ business-listings-c.asp?C_ID=${revmapfile2:$1} [NC,L]


IF I dont' the second just redirects to the website home page
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 29 August 2011 at 6:38am

elvy1973, I've seen this .htaccess. It's okay. It always was.
I need .LOG to see HOW request was processed. This issue is of a magical realm, so we need to see the whole process. It may not be ISAPI_Rewrite at all(IIS, code
page issue, etc.).

Regards
Andrew
Back to Top
 
elvy1973
Newbie


Joined: 12 October 2010
Posts: 19
Posted: 29 August 2011 at 6:57am

Hi Andrew:� I just recieved this log from shared host. Hope it's what you are looking for:
<span lang="EN-IE"><span lang="EN-IE">83.138.8.102 83.138.8.102 Mon,
29-Aug-2011 12:29:44 GMT [www.newbridgetown.com/sid#9207][rid#19291992/initial]
(2) init rewrite engine with requested uri
/accommodation-in-newbridge.html</span></span>


83.138.8.102 83.138.8.102 Mon, 29-Aug-2011 12:29:44 GMT [www.newbridgetown.com/sid#9207][rid#19291992/initial] (1) Htaccess process request C:\Program
Files\Helicon\ISAPI_Rewrite3\httpd.conf


......

83.138.8.102 83.138.8.102 Mon, 29-Aug-2011 12:29:46 GMT [www.newbridgetown.com/sid#9207][rid#19277192/initial] (3) applying pattern '^([^/]+)\.html$' to uri
'img_library/products/standard/seven-springs-bed-and-breakfast-T.jpg'





Edited by AndrushkaUS - 29 August 2011 at 7:19am
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 29 August 2011 at 7:28am

I edited your last post to make it smaller.
I also edited the log to make it more readable:

Code:
(2) init rewrite engine with requested uri /accommodation-in-newbridge.html
(3) applying pattern '.?' to uri 'accommodation-in-newbridge.html'
(4) RewriteCond: input='off' pattern='(on)?' => matched
(4) RewriteCond: input='www.newbridgetown.com' pattern='^(?!www\.)(.+)$' => not-matched
(3) applying pattern '^index\.asp$' to uri 'accommodation-in-newbridge.html'
(3) applying pattern '^business-listings-s\.asp$' to uri 'accommodation-in-newbridge.html'
(3) applying pattern '^([^/]+)\.html$' to uri 'accommodation-in-newbridge.html'
(5) map lookup FAILED: map=revmapfile[txt] key=accommodation-in-newbridge
(1) Rewrite URL to >> /business-listings-s.asp?sC_ID=
(2) rewrite 'accommodation-in-newbridge.html' -> '/business-listings-s.asp?sC_ID='
(2) internal redirect with /business-listings-s.asp?sC_ID= [INTERNAL REDIRECT]

(2) init rewrite engine with requested uri /
(1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
(1) Htaccess process request d:\domains\newbridgetown.com\wwwroot\.htaccess
(3) applying pattern '.?' to uri ''
(4) RewriteCond: input='off' pattern='(on)?' => matched
(4) RewriteCond: input='www.newbridgetown.com' pattern='^(?!www\.)(.+)$' => not-matched
(3) applying pattern '^index\.asp$' to uri ''
(3) applying pattern '^business-listings-s\.asp$' to uri ''
(3) applying pattern '^([^/]+)\.html$' to uri ''
(3) applying pattern '^business-listings-c\.asp$' to uri ''
(3) applying pattern '^([^/]+)\.html$' to uri '


Which reflects 2 request. First one is /accommodation-in-newbridge.html and the second one is for the root of the web-site.
Was the request for accommodation-in-newbridge.html made for business-listings-s.asp?sC_ID= or for business-listings-c.asp?C_ID=?
What if you comment out the first(working) rule? Will the other one work?

Regards
Andrew

Edited by AndrushkaUS - 29 August 2011 at 8:02am
Back to Top
 
elvy1973
Newbie


Joined: 12 October 2010
Posts: 19
Posted: 29 August 2011 at 8:40am

The request for accommodation-in-newbridge.html was made for business-listings-c.asp?C_ID=?. This rule currently does not work as just redirects to the root of the website.

YES
If I comment out the first (working) rule this rule does then work as the business-listings-c.asp?C_ID=1 is displayed and the address bar reads  accommodation-in-newbridge.html


Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 29 August 2011 at 9:01am

Then you need to consider the fact, that the following two rules from different sections match the same thing and with no additional condition the first, that matches the request will make another one fall apart. You can verify that by
switching the places of the rules.

Code:
RewriteRule ^([^/]+)\.html$ business-listings-s.asp?sC_ID=${revmapfile:$1} [NC,L]

and
Code:
RewriteRule ^([^/]+)\.html$ business-listings-c.asp?C_ID=${revmapfile2:$1} [NC,L]


I suggest you take a look at How to check if the value is present in map file prior to processing the URL to avoid fruitless actions? in FAQ
Back to Top
 
elvy1973
Newbie


Joined: 12 October 2010
Posts: 19
Posted: 31 August 2011 at 6:37am

Thanks again Andrew


I changed the .htaccess to the following

RewriteBase /

#RULE ONE SUBCATEGORIES
RewriteMap mapfile txt:_mapfile-subcats.txt
RewriteMap revmapfile txt:_revmapfile-subcats.txt

#RULE TWO CATEGORIES
RewriteMap mapfile2 txt:_mapfile-cats.txt
RewriteMap revmapfile2 txt:_revmapfile-cats.txt


 
RewriteCond %{QUERY_STRING} ^sC_ID=(.*)$ [NC]
RewriteCond ${mapfile:$1|NOT_FOUND} !NOT_FOUND
RewriteRule ^business-listings-s\.asp$ /${mapfile:%1}.html? [NC,R=301,L]
RewriteRule ^([^/]+)\.html$ business-listings-s.asp?sC_ID=${revmapfile:$1} [NC,L]


RewriteCond %{QUERY_STRING} ^C_ID=(.*)$ [NC] 
RewriteCond ${mapfile2:$1|NOT_FOUND} !NOT_FOUND
RewriteRule ^business-listings-c\.asp$ /${mapfile2:%1}.html? [NC,R=301,L]
RewriteRule ^([^/]+)\.html$ business-listings-c.asp?C_ID=${revmapfile2:$1} [NC,L]

----------------------------------------------------

By adding the lines in RED before each rule

Both links worked but the url's where not rewritten in address bar as search engine friendly urls.

Old url's where displayed

e.g.
http://www.newbridgetown.com/business-listings-s.asp?sC_ID=1
and
http://www.newbridgetown.com/business-listings-c.asp?C_ID=1


I then changed .htaccess by removing

RewriteCond ${mapfile:$1|NOT_FOUND} !NOT_FOUND

from the first rule.


Now this rule works - the friendly url is displayed

e.g.

http://www.newbridgetown.com/business-listings-s.asp?sC_ID=1
shows
http://www.newbridgetown.com/bed-and-breakfast-in-newbridge.html
in the address bar

The second rule still just shows original unwritten URL in address bar

http://www.newbridgetown.com/business-listings-c.asp?C_ID=2

At least the second rule is now not redirecting to home page.


Any ideas as to what I should do now. Realyy don't see what is wrong and in fairness do not know much about reg expressions and isapi
Back to Top
 
elvy1973
Newbie


Joined: 12 October 2010
Posts: 19
Posted: 31 August 2011 at 7:54am

Hi ANdrew - GOT IT WORKING by following a solution from another post. I changed my .htaccess to the following


-------------------------------------------------

 
RewriteBase /
RewriteMap mapfile2 txt:_mapfile-subcats.txt
RewriteMap revmapfile2 txt:_revmapfile-subcats.txt
RewriteMap mapfile3 txt:_mapfile-cats.txt
RewriteMap revmapfile3 txt:_revmapfile-cats.txt

RewriteCond %{QUERY_STRING} ^(.+)$ [NC]
RewriteCond ${mapfile2:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^business-listings-s\.asp$ ${mapfile2:%1}? [NC,R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond ${revmapfile2:$1|NOT_FOUND} !NOT_FOUND
RewriteRule ^(.+)$ business-listings-s.asp?${revmapfile2:$1} [NC,L]



RewriteCond %{QUERY_STRING} ^(.+)$ [NC]
RewriteCond ${mapfile3:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^business-listings-c\.asp$ ${mapfile3:%1}? [NC,R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond ${revmapfile3:$1|NOT_FOUND} !NOT_FOUND
RewriteRule ^(.+)$ business-listings-c.asp?${revmapfile3:$1} [NC,L]

--------------------------------------------------

and entered the parameters in the relavant mpafiles and reverse mapfiles

_mapfile-cats.txt  - view
_revmapfile-cats.txt - view

_mapfile-subcats.txt - view
_revmapfile-subcats.txt -  view

DOES ALL LOOK OK TO YOU, also any idea as to why this worked and previous rules didn't

Thanks for all,
Niall


Back to Top
 

Page of 2 Next >>
 
Printable version Printable version