Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在wamp不工作的情况下删除codeigniter中的index.php_Php_.htaccess_Codeigniter_Url - Fatal编程技术网

在wamp不工作的情况下删除codeigniter中的index.php

在wamp不工作的情况下删除codeigniter中的index.php,php,.htaccess,codeigniter,url,Php,.htaccess,Codeigniter,Url,在使用Wamp服务器从Codeigniter 3的url中删除index.php时,我遇到了问题。我正在修改config.php文件(project_folder/application/config/config.php) 并创建与已编写代码相同级别的应用程序文件夹的.htaccess文件 <IfModule mod_rewrite.c> # Turn on URL rewriting RewriteEngine On # If your website begins from

在使用Wamp服务器从Codeigniter 3的url中删除index.php时,我遇到了问题。我正在修改config.php文件(project_folder/application/config/config.php)

并创建与已编写代码相同级别的应用程序文件夹的.htaccess文件

<IfModule mod_rewrite.c>
# Turn on URL rewriting
RewriteEngine On

# If your website begins from a folder e.g localhost/my_project then 
# you have to change it to: RewriteBase /my_project/
# If your site begins from the root e.g. example.local/ then
# let it as it is
RewriteBase /

# Protect application and system files from being viewed when the index.php is missing
RewriteCond $1 ^(application|system|private|logs)

# Rewrite to index.php/access_denied/URL
RewriteRule ^(.*)$ index.php/access_denied/$1 [PT,L]

# Allow these directories and files to be displayed directly:
RewriteCond $1 ^(index\.php|robots\.txt|opensearch\.xml|favicon\.ico|assets|forums)

# No rewriting
RewriteRule ^(.*)$ - [PT,L]

# Rewrite to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [PT,L]
</IfModule>

谢谢

在.htaccess文件上尝试此代码

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
config.php
页面上设置
$config['base\u url']=”http://localhost/project/“
$config['index\u page']=”
$config['uri_protocol']='AUTO'

尝试以下方法:

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


    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
    RewriteCond $1 !^(index\.php|images|stylesheets|javascript)
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

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

重新启动发动机
重写项目的基本/文件夹名称/
重写COND%{REQUEST_URI}^系统*
重写规则^(.*)$/index.php?/$1[L]
重写cond%{REQUEST_URI}^应用程序*
重写规则^(.*)$/index.php?/$1[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
1美元^(索引\.php |图像|样式表| javascript)
重写规则^(.*)$index.php?/$1[L]
ErrorDocument 404/index.php

阅读本教程,通过更改虚拟主机文件httpd-vhosts.conf(C:\wamp\bin\apache\apache2.4.9\conf\extra),将“订单允许、拒绝”替换为“允许所有人”即可解决上述问题!单击Wampserver并选择apache->httpd.conf并从LoadModule rewrite\u module modules/mod_rewrite.so中删除。最后重新启动Wamp服务器
abc.local/controllername
Not found
The requested URL /controllername/ was not found on this server.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /folder_name_of_project/


    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
    RewriteCond $1 !^(index\.php|images|stylesheets|javascript)
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

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