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: CakePHP rewrite (Topic Closed Topic Closed)
Author
Message |
uniacid
Newbie


Joined: 17 June 2008
Posts: 3
Posted: 17 June 2008 at 5:42pm  

I'm using the latest version of ISAPI_Rewrite 3.1.0.49 on IIS6 (Win2k3)
It doesn't seem like the UriFormatPrefix directive isn't supported anymore and I need to find a solution.

I'm trying to use this for my htaccess rules:
UriFormatPrefix /app/webroot

RewriteRule ^/(img|css|files|js)(.*)$ /$1$2 [L]
RewriteRule ^/$ /index.php [L]
RewriteRule ^/(.+)\?(.*)$ /index.php?url=/$1&$2 [L]
RewriteRule ^/(.*)$ /index.php?url=/$1 [L]


Back to Top
 
Yaroslav
Admin Group


Joined: 15 August 2002
Posts: 6520
Posted: 18 June 2008 at 10:30am  

Simply repeat /app/webroot for every format. ISAPI_Rewrite 3 supports RawriteBase directive, but it is applied to both format and request parts.

__________________
Yaroslav Govorunov,
Helicon Tech
Back to Top Visit Yaroslav's Homepage
 
deizel
Newbie


Joined: 18 June 2008
Location: United Kingdom
Posts: 3
Posted: 20 June 2008 at 9:28am  

Here is what I have and it seems to be working fine for me:

Code:
# CakePHP
RewriteRule ^/cake/(css|files|img|js|stats)/(.*)$ /cake/app/webroot/$1/$2 [L]
RewriteRule ^/cake/$ /cake/index.php [L]
RewriteRule ^/cake/(.+)\?(.*)$ /cake/index.php?url=/$1&$2 [L]
RewriteRule ^/cake/(.*)$ /cake/index.php?url=$1 [L]

Bear in mind this only works with the following (standard) directory structure.

Code:
C:\inetpub\wwwroot\cake\
C:\inetpub\wwwroot\cake\app
C:\inetpub\wwwroot\cake\app\webroot
C:\inetpub\wwwroot\cake\cake
C:\inetpub\wwwroot\cake\vendors


Alternatively, you can store the CakePHP folder outside of the wwwroot directory (arguably more secure), instead only keeping the webroot folder, like follows:

Code:
C:\cake\
C:\cake\app
C:\cake\cake
C:\cake\vendors
C:\inetpub\wwwroot\cake # Previously C:\inetpub\wwwroot\cake\app\webroot


I haven't used this approach, but if you decide to do so, you need to use this less complicated RewriteRule instead:

Code:
# CakePHP - if path doesn't physically exist, pass to cake
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/cake/(.*)$ /cake/index.php?url=$1 [QSA,L]


Also, edit the index.php from webroot as follows (you could alternatively define these in config/bootstrap.php or config/core.php):

Code:
    if (!defined('ROOT')) {
        define('ROOT', 'C:' . DS . 'cake');
    }
    if (!defined('APP_DIR')) {
        define('APP_DIR', 'app');
    }
    if (!defined('CAKE_CORE_INCLUDE_PATH')) {
        define('CAKE_CORE_INCLUDE_PATH', ROOT);
    }

Hope this helps you and any other fellow cake bakers out there.


__________________
d.
Back to Top
 
uniacid
Newbie


Joined: 17 June 2008
Posts: 3
Posted: 21 June 2008 at 5:56pm  

Thanks,

I've tried this and yes it works for the most part but I am seeing other issues with some of the auth lib I am using for Cake and it seems like it is not finding the proper controllers, not sure if its IIS but I tested the same code on another windows/Apache server and it works.

:/
Back to Top
 
mattboothman
Newbie


Joined: 06 August 2009
Posts: 3
Posted: 06 August 2009 at 8:04pm  

What version of cake is this?
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 10 August 2009 at 2:00am  

I'm not sure you'll get an answer in the post closed over a year ago.
If you encounter any problems with ISAPI_Rewrite, please start a new topic and explain your issue in details.

__________________
Regards,
Anton
Back to Top
 

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

Printable version Printable version