简体   繁体   English

删除codeigniter中的index.php。 我的项目在子文件夹中

[英]remove index.php in codeigniter. my project is in subfolder

I am trying to remove index.php in codeigniter.my codegiter project is inside public_html/programemis/lasoona/ .I have my .htacess file with the following code. 我正在尝试删除codeigniter.my中的index.php ,我的codegiter项目位于public_html/programemis/lasoona/ 。我的.htacess文件包含以下代码。

RewriteEngine on
RewriteBase /lasoona/
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

but its not working .any one please help. 但它不起作用。任何人都可以帮助。

Try this : 尝试这个 :

RewriteEngine on
RewriteBase /programemis/lasoona/
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /programemis/lasoona/index.php?/$1 [L,QSA]

There have been a lot of solutions posted online for this. 在线上已经发布了很多解决方案。 Here's from stackoverflow itself: 这是来自stackoverflow本身:

Codeigniter remove index.php - htaccess localhost Codeigniter删除index.php-htaccess本地主机

If it won't work, here's another (this works for me) based from: 如果它不起作用,则基于以下内容的另一个(对我有用):

https://docs.expressionengine.com/latest/urls/remove_index.php.html https://docs.expressionengine.com/latest/urls/remove_index.php.html

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{REQUEST_URI} !/system/.* [NC]
        RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule .* index.php/$0 [PT,L]
</IfModule>

Just be mindful of the location of .htaccess . 请注意.htaccess的位置。

在此处输入图片说明

I use it and working try it. 我使用它并尝试尝试。 If dont work remove programemis folder from RewriteBase. 如果不起作用,请从RewriteBase中删除programemis文件夹。 If you get same problem I recommented create a sub-domain. 如果您遇到相同的问题,我建议您创建一个子域。

RewriteEngine on
RewriteBase /programemis/lasoona/
RewriteRule ^(application|system|\.svn) index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM