This forum has been moved here:
Helicon Tech Community Forum

Helicon Ape (Forum Locked Forum Locked)
 Helicon Tech : Helicon Ape
Subject Topic: rewrite rule help..
Author
Message |
paladincomp
Newbie


Joined: 16 June 2006
Location: United States
Posts: 11
Posted: 01 December 2010 at 2:10pm

Hi guys!

First, I wanted to say I've been using your products for years and LOVE
them. They are the best! You guys also have the best support! I usually
don't have to bother you as your software just works and works with no
problems until I need to change it as I totally screw up the REGEX and
rules to get what I want done. (Maybe a user guide for idiots would be
helpful).

Ok.. I have the following in my .htaccess file and it works great:

=============
# Helicon Ape version 3.0.0.57

RewriteEngine On
RewriteBase

# Block external access to the httpd.ini and httpd.parse.errors files
RewriteRule ^/httpd(?:\.ini|\.parse\.errors).*$ / [NC,F,O]
# Block external access to the Helper ISAPI Extension
RewriteRule ^.*\.isrwhlp$ / [NC,F,O]

RewriteRule ^/index(.*)\.html?$ /index.cfm$1
RewriteRule ^(.*?\.cfm)(\?[^/]*)?/([^/]*)/([^/]*)(.*)$ $1(?2$2&:\?)$3=$4$5
[NC,LP]

RewriteRule ^/index(.*)\.html\??$ /index.cfm$1
RewriteRule ^(.*?\.cfm)(\?[^/]*)?/([^/]*)/([^/]*)(.*)$ $1(?2$2&:\?)$3=$4$5
[NC,LP]
=============
This takes a request like:

http://www.mydomain.com/index/method/c.home/var1/A/var2/B.html

and rewrites it to

http://www.mydomain.com/index.cfm?method=c.home&var1=A&var2=B

This is obviously for a ColdFusion server (version 8, Windows server
2008). This is rock solid and has been working for years!


My company now wants to add support for short URL's for marketing, SEO
etc. What I'm trying to do is something like this:

http://www.mydomain.com/x/URLCODE

rewrites to

http://www.mydomain.com/redirect.cfm?code=URLCODE

I tried adding this line as a this simple test:

RewriteRule ^/x/(.*) /redirect.cfm

But I get this error:

-------------
The service is unavailable.
Server Error

Either the Macromedia application server(s) are unreachable or none of
them has a mapping to process this request.
-------------

If I change the destination to anything else, it works (txt, etc)

The other CFM redirects are still working fine so I know the server
recognizes the CFM thrown at it in the original script.

Do you have any ideas of where I should go from here?

Thanks so much!!!!



Edited by paladincomp - 01 December 2010 at 2:10pm


__________________
Tom Nunamaker
Paladin Computers
www.paladincomputer.net
Back to Top Visit paladincomp's Homepage
 
Vyacheslav
Admin Group


Joined: 02 July 2008
Location: Ukraine
Posts: 1542
Posted: 01 December 2010 at 3:30pm

Hello.
ColdFusion requires additional setup. Please use the following article to get it working: http://www.helicontech.com/articles/adjusting-coldfusionisapi_rewrite-collaboration/

Your code also needs a little correction:
Code:
RewriteRule ^/x/(.*) /redirect.cfm?code=$1 [NC,L]


__________________
Slavik Shynkarenko,
Helicon Tech.
Back to Top Visit Vyacheslav's Homepage
 
paladincomp
Newbie


Joined: 16 June 2006
Location: United States
Posts: 11
Posted: 01 December 2010 at 3:47pm

Hi Slavik,

Thanks for the quick reply!

My ColdFusion server is setup as a JRun4 server. I edited the paths in
your web.config to c:\JRun4\lib\wsconfig\1\jrun_iis6_wildcard.dll" and I
had a different behavior.

The redirected page displayed the code like it was a .txt file. Then my old
reliable redirects to index.cfm were broken and throwing a 500 server
error.

Are you sure I need to add that handler code? It's already working for
.cfm redirects with the old code. What changed that the handler code
needs to be added?

Thanks so much!

__________________
Tom Nunamaker
Paladin Computers
www.paladincomputer.net
Back to Top Visit paladincomp's Homepage
 
Vyacheslav
Admin Group


Joined: 02 July 2008
Location: Ukraine
Posts: 1542
Posted: 01 December 2010 at 4:31pm

Clients usually need that configuration.
Have you tried suggested rule? And are you saying that another part of your code already works with ColdFusion?

__________________
Slavik Shynkarenko,
Helicon Tech.
Back to Top Visit Vyacheslav's Homepage
 
paladincomp
Newbie


Joined: 16 June 2006
Location: United States
Posts: 11
Posted: 01 December 2010 at 4:42pm

Hi Slavik!

Yes.. this is a production site:
http://www.sheridanmentoring.com/index/method/c.weekly-options-
class/sbs/0.html

is correctly being rewritten as

http://www.sheridanmentoring.com/index.cfm?method=c.weekly-
options-class&sbs=0

then passed to ColdFusion and executed.

That's the existing .htaccess I showed at the start of my original post.

I tried the suggested changes for web.config but it started throwing 500
errors on pages like
the above which are working fine already.

When I add the new rule to handle the new rule you wrote (thanks so
much btw).. I get the service not available error ONLY ON THAT RULE! The
existing (old) rules work perfectly still.

HTH



Edited by paladincomp - 01 December 2010 at 4:43pm


__________________
Tom Nunamaker
Paladin Computers
www.paladincomputer.net
Back to Top Visit paladincomp's Homepage
 
Vyacheslav
Admin Group


Joined: 02 July 2008
Location: Ukraine
Posts: 1542
Posted: 01 December 2010 at 5:14pm

Hello.
Please try the following code:
Code:
RewriteRule ^/x/(.*) /redirect.cfm?code=$1 [NC,NS,L]


Also add “L” flag to every RewriteRule you have.

__________________
Slavik Shynkarenko,
Helicon Tech.
Back to Top Visit Vyacheslav's Homepage
 
paladincomp
Newbie


Joined: 16 June 2006
Location: United States
Posts: 11
Posted: 01 December 2010 at 5:20pm

Hi Slavik,

I modified the rule as suggested and I still get the error

The service is unavailable.
Server Error

Either the Macromedia application server(s) are unreachable or none of
them has a mapping to process this request.

when trying to invoke the rule; however, all other pages using the other
rules work fine.

I added the L flag to the rewrite rules as suggested also.


__________________
Tom Nunamaker
Paladin Computers
www.paladincomputer.net
Back to Top Visit paladincomp's Homepage
 
paladincomp
Newbie


Joined: 16 June 2006
Location: United States
Posts: 11
Posted: 02 December 2010 at 2:41pm

Do you have any other ideas I can try?

Thanks


__________________
Tom Nunamaker
Paladin Computers
www.paladincomputer.net
Back to Top Visit paladincomp's Homepage
 
Vyacheslav
Admin Group


Joined: 02 July 2008
Location: Ukraine
Posts: 1542
Posted: 02 December 2010 at 4:26pm

Hello.
Please set up logs according to the “Troubleshooting” section: http://www.helicontech.com/ape/doc/troubleshooting.htm and send me rewrite.log records. You can use email if you’re not comfortable with forums: [email protected]

Thanks.

__________________
Slavik Shynkarenko,
Helicon Tech.
Back to Top Visit Vyacheslav's Homepage
 
Vyacheslav
Admin Group


Joined: 02 July 2008
Location: Ukraine
Posts: 1542
Posted: 03 December 2010 at 5:33pm

Hello.
Have you managed to get rewrite.log records? Please create a ticket in our Helpdesk System http://support.helicontech.com/helpdesk/.
I’ll be happy to provide you with remote assistance.
Thanks.

__________________
Slavik Shynkarenko,
Helicon Tech.
Back to Top Visit Vyacheslav's Homepage
 
paladincomp
Newbie


Joined: 16 June 2006
Location: United States
Posts: 11
Posted: 24 December 2010 at 7:52pm

I noticed in IIS the ISAPI filters are pointing to

C:\Program Files\Helicon\ISAPI_Rewrite\\ISAPI_Rewrite.dll

but APE is installed at

C:\Program Files (x86)\Helicon\Ape

I changed the references to

C:\Program Files\Helicon\ISAPI_Rewrite\ISAPI_Rewrite.dll

But so far no change. All redirects work except the ones
to coldfusion on the new sites.



__________________
Tom Nunamaker
Paladin Computers
www.paladincomputer.net
Back to Top Visit paladincomp's Homepage
 
paladincomp
Newbie


Joined: 16 June 2006
Location: United States
Posts: 11
Posted: 25 December 2010 at 11:48am

I found out what the problem was!

There were still httpd.ini files in the sites! When I copied the httpd.ini file
from the old site to the new one. BAM! Worked just fine.

I'm glad it ended up being such a simple solution!



__________________
Tom Nunamaker
Paladin Computers
www.paladincomputer.net
Back to Top Visit paladincomp's Homepage
 

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

Printable version Printable version