Codeigniter | OVH | htaccess / url rewriting | Site very slow

落花浮王杯 提交于 2020-01-22 02:10:10

问题


Here is my htaccess for removing the index.php with codeigniter :

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

But with this .htaccess, there is an error "File not found." So, I'm searching, and here is a little solution : http://forum.ovh.com/showthread.php?93572-Codeigniter-et-htaccess

Adding a "?" resolve the problem, but the site is sometimes very very slow, and sometimes very fast ! And sometimes, my style sheets don't load (assets/css/)...

What is the problem ? I think it's the htaccess but I'm not sure.

spec.: Host : OVH php ver. : 5.2 CI ver. : 2.1.4


回答1:


Try this code from the 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:


try this out:

            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]



回答3:


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

write this in your htaccess check this link to enable mod_rewrite function of apache setting



来源:https://stackoverflow.com/questions/24375249/codeigniter-ovh-htaccess-url-rewriting-site-very-slow

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