Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 3.0
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: CakePHP rewrite (Topic Closed Topic Closed) Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
uniacid
Newbie
Newbie


Joined: 17 June 2008
Online Status: Offline
Posts: 3
Posted: 17 June 2008 at 5:42pm | IP Logged  

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 View uniacid's Profile Search for other posts by uniacid
 
Yaroslav
Moderator Group
Moderator Group


Joined: 15 August 2002
Online Status: Offline
Posts: 6488
Posted: 18 June 2008 at 10:30am | IP Logged  

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 View Yaroslav's Profile Search for other posts by Yaroslav Visit Yaroslav's Homepage
 
deizel
Newbie
Newbie


Joined: 18 June 2008
Location: United Kingdom
Online Status: Offline
Posts: 3
Posted: 20 June 2008 at 9:28am | IP Logged  

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 View deizel's Profile Search for other posts by deizel
 
uniacid
Newbie
Newbie


Joined: 17 June 2008
Online Status: Offline
Posts: 3
Posted: 21 June 2008 at 5:56pm | IP Logged  

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 View uniacid's Profile Search for other posts by uniacid
 
mattboothman
Newbie
Newbie


Joined: 06 August 2009
Online Status: Offline
Posts: 3
Posted: 06 August 2009 at 8:04pm | IP Logged  

What version of cake is this?
Back to Top View mattboothman's Profile Search for other posts by mattboothman
 
Anton
Moderator Group
Moderator Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 9798
Posted: 10 August 2009 at 2:00am | IP Logged  

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 View Anton's Profile Search for other posts by Anton
 

Sorry, you can NOT post a reply.
This topic is closed.

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You can vote in polls in this forum