Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/289.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
无法使用htaccess删除index.php_Php_Apache_.htaccess_Codeigniter - Fatal编程技术网

无法使用htaccess删除index.php

无法使用htaccess删除index.php,php,apache,.htaccess,codeigniter,Php,Apache,.htaccess,Codeigniter,当我尝试删除index.php时 和访问控制器:mysite.com/admin 我不断收到内部服务器错误。 我不知道为什么它不起作用 .htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /code/ RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ index.php?/$1 [L] RewriteCond %{REQUEST_URI} ^a

当我尝试删除index.php时 和访问控制器:mysite.com/admin 我不断收到内部服务器错误。 我不知道为什么它不起作用

.htaccess

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

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>
RewriteEngine On
RewriteBase /code/

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>
RewriteEngine On
RewriteBase /code/

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> 

我相信您不需要其他任何东西。

如果不仔细看一下,我发现
RewriteBase/code/

尝试使用
RewriteBase/

,您只需在项目文件夹中创建.htaccess文件并写入:
You just need to create .htaccess file in project folder and write:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all other URLs to index.php/URL 
RewriteRule ^(.*)$ index.php?url=$1 [PT,L] 

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

 #And You don't need to define in base_url in config file:

 $config['base_url'] = '';// blank it.

 I hope it will work perfectly ...
重新启动发动机 重写cond%{REQUEST_FILENAME}-F 重写cond%{REQUEST_FILENAME}-D #将所有其他URL重写为index.php/URL 重写规则^(.*)$index.php?url=$1[PT,L] #ErrorDocument 404 index.php #您不需要在配置文件的base_url中定义: $config['base_url']=''空白。 我希望它能完美地工作。。。
您是否查看了服务器错误日志,以准确了解问题的原因?你应该自己做一些基本的调试,总是从查看日志开始,而不是让我们猜测问题。嘿,我有Index.php而不是Index.php,你能帮我吗?
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php [L,NC]
You just need to create .htaccess file in project folder and write:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all other URLs to index.php/URL 
RewriteRule ^(.*)$ index.php?url=$1 [PT,L] 

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

 #And You don't need to define in base_url in config file:

 $config['base_url'] = '';// blank it.

 I hope it will work perfectly ...