Forum

Rewrite rule conversion

Samiux
9 February 2011, 12:29


Hiawatha version: 7.4
Operating System: Ubuntu server 10.10

The .htaccess of CakePHP is as the following :

RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 &*91;L&*93;


How to convert to Urltoolkit rule?

Thanks

Samiux
Hugo Leisink
9 February 2011, 12:57
Match ^/$ Rewrite /webroot/
Match ^/(.*) Rewrite /webroot/$1

I think that the first line can be left out, because it's covered by the second line.

I have no idea what &*91;L&*93; means and what it does.
Samiux
9 February 2011, 17:55
Thank you for your quick reply. However, I find out that there is another .htaccess at another directory that cause the CakePHP not workable under Hiawatha. They are :

app/webroot/.htaccess

RewriteCond %{REQUEST_FILENAME} ! -d
RewriteCond %{REQUEST_FILENAME} ! -f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]


app/.htaccess

RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]


Thanks.

Samiux
Hugo Leisink
9 February 2011, 21:44
Have you tried the one from the HOWTO page?
Samiux
10 February 2011, 05:30
Yes, I did. But I got "404 Not Found" error except the test "Welcome" page.

Samiux
Samiux
10 February 2011, 06:06
Oh sorry, you have make some changes on the HOWTO.

It works partially. No CSS can be read.

Samiux
Hugo Leisink
10 February 2011, 09:02
I've updated the CakePHP rewrite rule in the HOWTO page again. Please retry.
Samiux
10 February 2011, 17:05
Thank you for your reply. Your new version missed "Rewrite" at two rules. The final versions for Core and Bake version of CakePHP are as the following. They are working flawlessly. Please amend the HOWTO accordingly, thanks.

For CakePHP core :

UrlToolkit {
ToolkitID = cakephp
Match ^/app/webroot/ Skip 2
Match ^/app/(.*) Rewrite /$1 Continue
Match ^/(.*) Rewrite /app/webroot/$1 Continue
RequestURI exists Return
Match (.*)\?(.*) Rewrite $1&$2 Continue
Match ^/app/webroot/(.*) Rewrite /app/webroot/index.php?url=$1
}


For CakePHP that for Baking :

UrlToolkit {
ToolkitID = cakephp_apps
Match ^/webroot/ Skip 2
Match ^/(.*) Rewrite /$1 Continue
Match ^/(.*) Rewrite /webroot/$1 Continue
RequestURI exists Return
Match (.*)\?(.*) Rewrite $1&$2 Continue
Match ^/webroot/(.*) Rewrite /webroot/index.php?url=$1
}


Thank you for your assistance. =D

Samiux
This topic has been closed.