Configure htaccess to work with IIRF on IIS6 - codeigniter

六月ゝ 毕业季﹏ 提交于 2019-12-24 03:18:08

问题


i just created a website with CodeIgniter, the problem was with our server that running on windows server 2003 with IIS6,

when calling the website it displays only the homepage, and the other pages displays 404 error page due to .htaccess limitation on IIS6,

the support told me that he did a setup for a program called IIRF to enable moderewrite but still i need to use another rewrite expression that the one was in the htaccess

here is my htaccess content

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /root/

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^mvc/core_business.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^mvc.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
 </IfModule>

 <IfModule !mod_rewrite.c>
   # If we don't have mod_rewrite installed, all 404's
   # can be sent to index.php, and everything works as normal.
   # Submitted by: ElliotHaughin
   ErrorDocument 404 /index.php
 </IfModule> 

回答1:


Put this in IIRF.ini :

RewriteEngine On
RewriteBase 

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^mvc/core_business.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^mvc.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]



回答2:


IIS does not support .htaccess files - that is Apache feature.

You have to install the IIRF to have any rewriting at all, but still it will not be exactly the same.

See IIRF website for more information, or consider using Apache for Windows ;)



来源:https://stackoverflow.com/questions/11210225/configure-htaccess-to-work-with-iirf-on-iis6-codeigniter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!