简体   繁体   English

Codeigniter从Wamp中的URL删除index.php

[英]codeigniter removing index.php from url in wamp

I have big problem trying to remove index.php from url's 我在尝试从网址中删除index.php时遇到了大问题

i have searched lots if forums (this also), but no help for my situation. 我已经搜索了很多论坛(这也是),但对我的情况没有帮助。

so i have config.php file 所以我有config.php文件

$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';

my .htaccess file in public_html folder near index.php 我在index.php附近的public_html文件夹中的.htaccess文件

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /public_html/

    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]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule> 

and in WAMP apache (ver.: 2.4.9) i have rewrite_module ON (and it's working) and my httpd.conf AllowOverride set to All 和在WAMP apache(版本:2.4.9)中,我已将rewrite_module设置为ON(并且正在运行),并且将我的httpd.conf AllowOverride设置为All

so when i am going to mydomain.com/controller/action - I get 404 but when i go to mydomain.com/index.php/controller/action - everything is OK.. 所以当我转到mydomain.com/controller/action-我得到404,但是当我转到mydomain.com/index.php/controller/action-一切都OK。

i have tried lots of .htaccess examples... and so on.. nothing helps.. 我已经尝试了很多.htaccess示例...等等。

Use this htacess and then go to config.php and remove index.php 使用此htacess,然后转到config.php并删除index.php

Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

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

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