ModRewrite不工作的codeigniter网站 [英] ModRewrite not working for codeigniter site

查看:238
本文介绍了ModRewrite不工作的codeigniter网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了modrewrite我的codeigniter网站,但是当我走进htaccess文件已经有之一。

  RewriteEngine叙述上
的RewriteCond $ l ^(指数\的.php?|组合\的.php?| _images |资产| _styles | _js |图标\ .ICO?|仪表板|邮箱)!
重写规则^(。*)$ /index.php/$1 [L]
 

然而,当我尝试在xxamp本地测试我的网站,我必须把的index.php 打破我所有的链接样式。有我丢失的东西?当站点是活不是必需的。

编辑:此网站上MAMP开发在OSX,我使用的XAMPP在Windows上,认为这可能是问题的一部分

解决方案

在我的CI项目中,我已经在.htaccess此数据。

  RewriteEngine叙述上
的RewriteBase /

#Removes用户访问到系统文件夹。
#Additionally这将允许您创建一个System.php控制器,
#previously这将是不可能。
#'系统'可以,如果你已重命名系统文件夹进行更换。
的RewriteCond%{REQUEST_URI} ^系统。*
重写规则^(。*)$ /index.php?/$1 [L]

#当你的应用程序文件夹没有在系统文件夹
#这个片断prevents用户到应用程序文件夹的访问
Fabdrol:由#Submitted
#Rename'应用'为您的应用程序文件夹名称。
的RewriteCond%{REQUEST_URI} ^应用。*
重写规则^(。*)$ /index.php?/$1 [L]

#Checks,查看是否用户正在试图访问一个有效的文件,
#such作为图像或CSS文档,如果这不是它发送的真实
#request的index.php
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^(。*)$的index.php?/ $ 1 [L]
 

I tried a modrewrite for my codeigniter site, but when I went into the htaccess file there was already one.

RewriteEngine on
RewriteCond $1 !^(index\.php?|combine\.php?|_images|assets|_styles|_js|favicon\.ico?|dashboard|mail)
RewriteRule ^(.*)$ /index.php/$1 [L]

However, when I try to locally test my site in xxamp, I have to put index.php which breaks all my style links. Is there something I'm missing? When the site is live it isn't required.

EDIT: This site was developed on MAMP on osx, i'm using xampp on windows, think that could be part of the problem?

解决方案

In my CI project I have this data in .htaccess

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} ^system.*
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} ^application.*
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]

这篇关于ModRewrite不工作的codeigniter网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆