CodeIgniter WITHOUT rewrite engine

#1
[eluser]Yours3lf[/eluser]
Hello all,

my web server is IIS 7.0, I have successfully installed PHP, and phpinfo() is working. I wanted to install the CodeIgniter, but as far as I figured out, since I don't have apache running I can't use the rewrite engine. Still, I want to use it under IIS server, so there comes my question: Is it possible to run CodeIgniters WITHOUT rewrite engine? If so, how?

thanks in advance,
Yours3lf

#2
[eluser]WanWizard[/eluser]
The docs would be a good start: http://ellislab.com/codeigniter/user-gui.../urls.html

#3
[eluser]skunkbad[/eluser]
I believe a windows server has some sort of rewriting capability, but you would have to search the docs or the internet to see if this is true. CI doesn't need to have the URLs rewritten to work, so just install it and see...

#4
[eluser]mddd[/eluser]
Yes you can run CodeIgniter without rewrites. Only thing is that your urls will look like this:
Code:
// 'normal' situation
www.example.com/controller/method
// without rewriting
www.example.com/index.php/controller/method

But most IIS installations I have seen at web hosters do include a rewrite engine. The syntax is almost the same as .htaccess.
(I think the system is more or less a copy of that). It is called Isapi rewrite. You put a file 'httpd.ini' instead of .htaccess.
Here is a sample from a working project:
Code:
[ISAPI_Rewrite]
# no www? go to www site
RewriteCond Host: (?!^www.mywebsite.com)(.+)
RewriteRule /(.*) http\://www.mywebsite.com/$2 [I,RP]

# rewrite for index.php
RewriteRule /(?:img|css|js|scripts|uploads)/(.*) $0 [I,L]
RewriteRule /(.*) /index.php/$1 [L]

#5
[eluser]Yours3lf[/eluser]
Okay that's what I've done:
I have copied the codeigniter code to the root directory and configured the config.php (set my base url to http://localhost/ which I'm using), and I have made the httpd.ini which you adviced with the following code:

Code:
[ISAPI_Rewrite]
# no www? go to www site
RewriteCond Host: (?!^localhost)(.+)
RewriteRule /(.*) http\://localhost/$2 [I,RP]

# rewrite for index.php
RewriteRule /(?:img|css|js|scripts|uploads)/(.*) $0 [I,L]
RewriteRule /(.*) /index.php/$1 [L]

is it correct? because it isn't working, it displays the welcome screen...

#6
[eluser]mddd[/eluser]
Unfortunately I am not an expert on Isapi. I try to work with Unix servers when I can. I got this file from some website and I was glad it worked, so I think I can't help you with any problems here.

#7
[eluser]Yours3lf[/eluser]
I've done some search and I got this:

you can pass-by the rewrite engine by calling php's header function and validating $_SERVER variables, so, with this my is working now Smile

for example:

Code:
<?php
if(stristr($_SERVER['REQUEST_URI'], '/some-directory/')){
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.my-website.com/--address from$_SERVER variables--");
}
?>

#8
[eluser]skunkbad[/eluser]
[quote author="Yours3lf" date="1272413990"]I've done some search and I got this:

you can pass-by the rewrite engine by calling php's header function and validating $_SERVER variables, so, with this my is working now Smile

for example:

Code:
<?php
if(stristr($_SERVER['REQUEST_URI'], '/some-directory/')){
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.my-website.com/--address from$_SERVER variables--");
}
?>
[/quote]

This seems really cheesy. You'd probably have the best success with rewrite help on a windows server forum. Actually.... and I don't mean to steer anyone away from this forum... but you might ask about getting the rewrite working over at phpfreaks.com. They even have a Microsoft IIS board

#9
[eluser]Kevv[/eluser]
If you're using IIS7.x you can use the "official" IIS URL Rewrite Module (http://www.iis.net/download/URLRewrite).

As well as providing the rewrite engine itself it also does a pretty good job of importing mod_rewrite (htaccess) rules into their IIS (web.config) equivalents. Just hit "import rules" and paste in the rules you want translated. It's not quite perfect but it should prove a good enough starting point Wink

#10
[eluser]Yours3lf[/eluser]
cheesy you mean cool?
i posted a topic in connection with this on phpfreaks.com's board you adviced hope they can help Smile


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.