如何从codeigniter项目中的URL中删除index.php
我正在Codeigniter中创建一个网站.我知道这是非常常见的问题,并且有很多关于Stack Overflow的解决方案.我几乎尝试了所有方法,但对我没有帮助.
I am creating a website in Codeigniter. This is very common issue I know and there are lots of solutions on Stack Overflow. I try almost all but nothing is helpful for me.
我只想从我的网址中删除index.php.有人告诉我该怎么做吗?
I just want to remove index.php from my url. Anybody please tell me how can I do it?
我已从配置文件的 $ config ['index_page']
部分中删除了index.php
I have removed index.php from the config file's $config['index_page']
section
我还检查了 $ config ['uri_protocol'] ='AUTO';
模式尝试同时使用模式auto和 REQUEST_URI
.
I also checked $config['uri_protocol'] = 'AUTO';
mode try both mode auto and REQUEST_URI
.
我现在的.httaccess文件结构是这样的:
My .httaccess file structure right now is this:
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>
有人可以告诉我该怎么做吗?
Can anybody please tell me how to do it?
=>更改配置文件:-
=> Change in config file :-
$config['base_url'] = 'http://123456/proj/';
$config['index_page'] = '';
=>更改.htaccess文件:-
=> change in .htaccess file :-
RewriteEngine on
RewriteCond $1 !^(index\.php|
(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]