Welcome Guest, Not a member yet? Register   Sign In
[solved] Rewrite redirect() generates backslash on IIS - Please help
#1

[eluser]Velin[/eluser]
Hi there,

I'm working on my second project in Codeigniter, and it's with great grief and horror that I have to publish this site on an IIS server.

In order to preserve my .htaccess rewrite functionality in my Codeigniter project, I have installed ISAPI Rewrite 3.0 on the IIS box to host the CI site.
My .htaccess file is copied directly from my Apache dev server, and it works flawlessly on IIS using ISAPI Rewrite, for just about everything.
So far ISAPI Rewrite 3.0 looks like a good piece of software.


However, when I attempt to use the redirect() function on my IIS box it redirects to a URL containing a backslash. - This does not happen on Apache, using exactly the same config.

While I realise that this is a probably an IIS/Rewrite problem, and probably doesn't have anything to do with CI, I was hoping one of you have encountered a similar problem.


Example:

On Apache: http://site.dev/login redirects correctly to http://site.dev/login/go
On IIS using the same rewrite conditions, the url redirects to http://site.dev\/login/go



My login controller looks as follows (not surprising):
---
function index()
{
redirect('login/go');
}
---


My .htaccess file:
---
RewriteEngine on
RewriteCond $1 !^(index\.php|img|css|js|robots\.txt)
RewriteRule ^(.*)$ \/index.php/$1 [L]
---


Any help or advise would be greatly apreciated, thanks.
#2

[eluser]Velin[/eluser]
I'm really desperate here - I need this project to go live this week, and the redirect issue is causing major problems.

Would it be possible to simply replace any backslashes "\" in the URI with a blank string ""?

Any ideas are welcome at this point.
#3

[eluser]Velin[/eluser]
I decided to write a new redirect function instead.

Should someone find this thread with the same problem, the redirect function is found in /system/helpers/url_helper.php

Annoying, but it works on Apache and IIS.




Theme © iAndrew 2016 - Forum software by © MyBB