views:

50

answers:

2

Hi,

I am developing a php application with Kohana framework which enables url rewriting by default.

I need to translate these rules defined in the htaccess file but I can't figure it out.

# Turn on URL rewriting
RewriteEngine On

# Installation directory
RewriteBase /kohana/

# Protect hidden files from being viewed
<Files .*>
 Order Deny,Allow
 Deny From All
</Files>

# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b index.php/$0 [L]

# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]

Thanks in advance!

A: 

The Apache Migration document probably has enough info to set you on the right course.

There's a forum thread (where I found the link) which might be handy too.

Lethargy
A: 

Thanks for the links Lethargy.

I have a working translation for the last rule, without the conditions:

RewriteRule .* index.php/$0 [PT]

becomes:

<If $path=~ "^/mysite/(.*)">
        NameTrans fn="rewrite" path="/mysite/index.php/$1"
</If>

This tells the server to process any suffix after /mysite/ into /mysite/index.php/ so that the index file can rewrite the URL. Nevertheless this rule can't directly access files on physical path level (like .css or .js) which is defined by the conditions in the htaccess file.

So i came up with a rule with these conditions, but doesn't seem to work:

<If ! -f $path or ! -d $path and $uri !~ "^/mysite/index.php$" and $path=~ "^/mysite/(.*)">
NameTrans fn="rewrite" path="/mysite/index.php/$1"
</If>

Can someone help me out with this ?

Sobek