Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: Apache .htaccess to IIS ISAPI Rewrite Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
exoiz
Newbie
Newbie


Joined: 01 June 2010
Online Status: Offline
Posts: 6
Posted: 01 June 2010 at 8:06am | IP Logged Quote exoiz

I have a .htaccess for an Apache server and would like to use the code for an IIS server using the ISAPI Rewrite. How would I go about changing the below to work?

Code:
Options -Indexes
Options +FollowSymlinks

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>

DirectoryIndex index.php index.html


Many Thanks
Back to Top View exoiz's Profile Search for other posts by exoiz
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10489
Posted: 01 June 2010 at 8:24am | IP Logged Quote Anton

Do you want it to be changed to ISAPI_Rewrite v2 syntax? Or maybe it's version 3? Please specify.
Also please notice that if you have a choice please opt for ISAPI_Rewrite 3 as it's 99% Apache mod_rewrite compatible.

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
exoiz
Newbie
Newbie


Joined: 01 June 2010
Online Status: Offline
Posts: 6
Posted: 01 June 2010 at 8:34am | IP Logged Quote exoiz

I downloaded isapi_rwl_x86_0073.msi (Standard installation package) and installed it on a Windows 2003 Server (IIS 6.0). I'm not entirely sure what syntax I need?

I have a website written in PHP using the CodeIgniter Framework and it is currently on an Apache 2.2 server using mod_rewrite. I just need to use the same code on an IIS server using the same rewrite code.

Code:
[ISAPI_Rewrite]

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]


The above doesn't seem to work, any ideas?

Thanks


Back to Top View exoiz's Profile Search for other posts by exoiz
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10489
Posted: 01 June 2010 at 9:12am | IP Logged Quote Anton

The first line is not needed in v3. All the rest should work fine:

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

Do you get an error?

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
exoiz
Newbie
Newbie


Joined: 01 June 2010
Online Status: Offline
Posts: 6
Posted: 01 June 2010 at 9:33am | IP Logged Quote exoiz

I have two setups, the old code on the server which is on the root which works perfectly and the new code on the server which is in a sub folder and using rewrite and get the error message below.

You are not authorized to view this page
You do not have permission to view this directory or page due to the access control list (ACL) that is configured for this resource on the Web server.

On another note should I have to add ISAPI_Rewrite as a Web Service Extension and set it to Allow?

Thanks
Back to Top View exoiz's Profile Search for other posts by exoiz
 
exoiz
Newbie
Newbie


Joined: 01 June 2010
Online Status: Offline
Posts: 6
Posted: 01 June 2010 at 10:12am | IP Logged Quote exoiz

The other message I am getting is below.

You are not authorized to view this page
The URL you attempted to reach has an ISAPI or CGI application installed that verifies user credentials before proceeding. This application cannot verify your credentials.

Do you have any ideas to what is configured incorrectly?

Thanks
Back to Top View exoiz's Profile Search for other posts by exoiz
 
exoiz
Newbie
Newbie


Joined: 01 June 2010
Online Status: Offline
Posts: 6
Posted: 01 June 2010 at 10:22am | IP Logged Quote exoiz

Figured out the above errors... NTFS security, which is now fixed :)

But my redirect is not working correctly, which is probably to do with my  CodeIgniter set up rather than ISAPE Rewrite.

The page cannot be found
HTTP Error 404 - File or directory not found.

Back to Top View exoiz's Profile Search for other posts by exoiz
 
exoiz
Newbie
Newbie


Joined: 01 June 2010
Online Status: Offline
Posts: 6
Posted: 01 June 2010 at 10:36am | IP Logged Quote exoiz

1) http://www.mysite.com/newsite/index.php?about
2) http://www.mysite.com/newsite/about

Number 1 works but the rewrite number 2 does not?

I have tried with both RewriteBase / and /newsite/

Code:
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]


I've tried all URI Protocols and assume AUTO should be okay?

URI PROTOCOL
'AUTO'
'PATH_INFO'
'QUERY_STRING'
'REQUEST_URI'
'ORIG_PATH_INFO'

Thanks
Back to Top View exoiz's Profile Search for other posts by exoiz
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10489
Posted: 03 June 2010 at 3:10am | IP Logged Quote Anton

Let's try the following config:

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php\?$1 [L]

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  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 cannot vote in polls in this forum