【问题标题】:Codeigniter | OVH | htaccess / url rewriting | Site very slow代码点火器 | OVH | htaccess / url 重写 |网站很慢
【发布时间】:2014-08-14 01:02:58
【问题描述】:

这是我用 codeigniter 删除 index.php 的 htaccess :

RewriteEngine On
RewriteCond $1 !^(index\.php|assets|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

但是使用这个 .htaccess,会出现“找不到文件”错误。 所以,我正在搜索,这里有一个小解决方案:http://forum.ovh.com/showthread.php?93572-Codeigniter-et-htaccess

添加一个“?”解决问题,但网站有时很慢,有时很快!有时,我的样式表无法加载 (assets/css/)...

有什么问题?我认为是 htaccess 但我不确定。

规格: 主持人:OVH php版本。 : 5.2 CI版本。 :2.1.4

【问题讨论】:

  • 不,但是 https 有什么问题?我已经用另一台服务器进行了测试,它在没有 https 的情况下工作

标签: .htaccess codeigniter mod-rewrite


【解决方案1】:

试试OVH Forum的这段代码:

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

【讨论】:

  • 如果你分享一段这样的代码,请在这里解释它的作用,而不是仅仅链接。
【解决方案2】:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L] 

在你的 htaccess 中写下这个 检查此链接以启用apache setting的mod_rewrite功能

【讨论】:

  • 谢谢,它更快,但我无法访问apache设置:(所以只有索引页面可以,样式表,图像,js也可以。其他页面(其他控制器) 不正常,显示“找不到文件。”消息
  • 我想我错过了它
  • @user3768981 这是你的服务器
【解决方案3】:

试试这个:

            RewriteEngine On
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} -s [OR]
            RewriteCond %{REQUEST_FILENAME} -l [OR]
            RewriteCond %{REQUEST_FILENAME} -d
            RewriteRule ^.*$ - [NC,L]
            RewriteRule ^.*$ index.php [NC,L]

【讨论】:

  • 谢谢,但看起来效果一样:/
猜你喜欢
  • 2011-07-28
  • 1970-01-01
  • 1970-01-01
  • 2013-02-27
  • 2016-10-20
  • 2015-11-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多