This forum has been moved here:
Helicon Tech Community Forum

Helicon Ape (Forum Locked Forum Locked)
 Helicon Tech : Helicon Ape
Subject Topic: CFM rewrite
Author
Message |
tvdh
Newbie


Joined: 02 August 2011
Location: Netherlands
Posts: 7
Posted: 02 August 2011 at 9:13am

Hello,

I have am planning to update my server from isapi rewrite to ape.
I have installed the trial version of ape.

There is a problem with a htaccess file, in isapi rewrite it works perfect, but with ape i get an error.

This is the part were it goes wrong:

RewriteEngine On
RewriteBase /
## If it's not a request for a real file.
RewriteCond %{SCRIPT_FILENAME} !-f
## Add the trailing slash. I removed the L flag because I want to process the next rule, <Files myscript>, but it's not actually a mod_rewrite rule so maybe I can leave it in.
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)$ $1/index.cfm

I get the following error ( i have changed my sitename):
(4) ape_module: 'http:/bla.testserver.bla.nl/test//index.cfm' is not a valid virtual path.

When i remove a / i still get the same error.

When i remove [R=301] it works perfect, but my site isnt working right then.

Can someone help me?
Back to Top
 
Vyacheslav
Admin Group


Joined: 02 July 2008
Location: Ukraine
Posts: 1542
Posted: 03 August 2011 at 9:27am

Hello.
Well, first you add trailing slash to any non-existent file (REQUEST_FILENAME is better by the way), then you forward that request to $1/index.cfm which expands into http:/bla.testserver.bla.nl/test//index.cfm

Could you please clarify the general purpose of the rules.
Thank you.

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


Joined: 02 August 2011
Location: Netherlands
Posts: 7
Posted: 05 August 2011 at 7:30am

These rules are used to place /index.cfm behind a url when a file or folder doesnt exist..
Back to Top
 
Vyacheslav
Admin Group


Joined: 02 July 2008
Location: Ukraine
Posts: 1542
Posted: 08 August 2011 at 7:36am

Hello.
Please try the following example:
Code:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+?)/?$ $1/index.cfm [R=301,L]


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


Joined: 02 August 2011
Location: Netherlands
Posts: 7
Posted: 19 August 2011 at 4:07am

When i try the example in ISAPI rewrite the browser tells me that the page i am visiting returns in a neverending loop.

The url is like this  http://url/index.cfm/index.cfm/index.cfm/index.cfm/index.cfm/index.cfm/index.cfm/index.cfm/index.cfm/index.cfm/index.cfm/index.cfm

Do you know what is wrong?
Back to Top
 
Vyacheslav
Admin Group


Joined: 02 July 2008
Location: Ukraine
Posts: 1542
Posted: 22 August 2011 at 4:41am

Hello.
Please try this:
Code:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(?!index\.cfm)(.+?)/?$ $1/index.cfm [NC,R=301,L]


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


Joined: 02 August 2011
Location: Netherlands
Posts: 7
Posted: 23 August 2011 at 3:33am

With this code I still have the same problem. 
Back to Top
 
Vyacheslav
Admin Group


Joined: 02 July 2008
Location: Ukraine
Posts: 1542
Posted: 26 August 2011 at 7:34am

Hello.
Could you please provide rewrite.log records.
Thank you.

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


Joined: 02 August 2011
Location: Netherlands
Posts: 7
Posted: 08 September 2011 at 8:21am

This is the log:

Edited by Anton - 21 October 2013 at 3:31am
Back to Top
 
Vyacheslav
Admin Group


Joined: 02 July 2008
Location: Ukraine
Posts: 1542
Posted: 12 September 2011 at 4:53am

Hello.
Please try this:
Code:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/[^/]+/index\.cfm$ [NC]
RewriteRule ^([^.?]+[^.?/])$ $1/index.cfm[NC,R=301,L]


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


Joined: 02 August 2011
Location: Netherlands
Posts: 7
Posted: 12 September 2011 at 6:13am

I think it is working now!

The only thing wrong is,

before the links were visible as: site.com/test
Now it is visible as: site.com/test/iindex.cfm

Do you know how i can solve this?

Thanks in advance


Edited by tvdh - 12 September 2011 at 6:21am
Back to Top
 
Vyacheslav
Admin Group


Joined: 02 July 2008
Location: Ukraine
Posts: 1542
Posted: 12 September 2011 at 8:13am

That’s what the rules do. When you add R=301 it redirects. What result would you like to see? Please explain with examples.
Thank you.

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


Joined: 02 August 2011
Location: Netherlands
Posts: 7
Posted: 28 September 2011 at 4:13am

Hello,

We have tested the rule further.
It is working when the url that is called is like:

http://site.com/blabla

But not when it is:

http://site.com/blabla/

Do you have a solution for that?
Back to Top
 
Vyacheslav
Admin Group


Joined: 02 July 2008
Location: Ukraine
Posts: 1542
Posted: 03 October 2011 at 4:56am

Hello.
Please try the following code:
Code:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/[^/]+/index\.cfm$ [NC]
RewriteRule ^(.+)$ $1/index.cfm [NC,R=301,L]


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

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

Printable version Printable version