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
CodeIgniter:卸下';php';从URL_Php_.htaccess_Codeigniter_Tankauth - Fatal编程技术网

CodeIgniter:卸下';php';从URL

CodeIgniter:卸下';php';从URL,php,.htaccess,codeigniter,tankauth,Php,.htaccess,Codeigniter,Tankauth,我以前已经回答过这个问题,甚至自己发布了答案。我试着回答了大部分问题,但仍然不起作用。第一个问题是关于.htaccess文件的位置,我应该将其保存在应用程序文件夹中还是在其中?下一个问题是“我应该如何从URL中删除index.php” .htaccess代码: RewriteEngine On RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{

我以前已经回答过这个问题,甚至自己发布了答案。我试着回答了大部分问题,但仍然不起作用。第一个问题是关于
.htaccess
文件的位置,我应该将其保存在应用程序文件夹中还是在其中?下一个问题是“我应该如何从URL中删除
index.php

.htaccess代码:

RewriteEngine On
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
Config.php代码:

$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
如果可能的话,还建议您提供一个详细的教程,介绍如何定制TankAuth或任何其他更容易的身份验证库。我正在使用Windows8.1和Wamp服务器


任何建议或帮助都将不胜感激。

请在.htaccess文件中使用:

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA] 
将./置于index.php重写规则之前。

或者这个

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]


有关更多详细信息,请参阅链接:

尝试使用此htaccess,它可以在windows 7和8.1以及xampp中正常工作

确保将.htaccess放置在主目录中,而不是应用程序文件夹中

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]
配置

$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
更多htaccess


肯定会有用的。

我想它会帮助你

.htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
在config.php中

$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
    $http = 'http'.((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '').'://';
    $newurl = str_replace('index.php', '', $_SERVER['SCRIPT_NAME']);
    $config['base_url'] = "$http".$_SERVER['SERVER_NAME'].''.$newurl;
    $config['modules_locations'] = array('http://localhost/astrido_admin/application/' . 'modules/');

$config['index_page'] = '';
$config['index_page'] = 'index.php';     change  to     $config['index_page'] = '’;

感谢
config.php中的更改此设置

$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
.htaccess中(注意:应放在应用程序文件夹外)


重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php/$1[L]
注意:有很多重复的问题。所以,在提出新问题之前,请检查您的下拉菜单(当您开始键入问题标题时,它会随附)是否存在或提供了答案

1.config.php

$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
    $http = 'http'.((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '').'://';
    $newurl = str_replace('index.php', '', $_SERVER['SCRIPT_NAME']);
    $config['base_url'] = "$http".$_SERVER['SERVER_NAME'].''.$newurl;
    $config['modules_locations'] = array('http://localhost/astrido_admin/application/' . 'modules/');

$config['index_page'] = '';
$config['index_page'] = 'index.php';     change  to     $config['index_page'] = '’;
2.创建.htaccess文件

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

它对我有效,顺便说一下,我使用v2.2.6

  • 在index.php所在的目录上创建.htaccess
  • 在/application/config/config.php中修改索引页面和基本url值
这是它的样子


您使用的是哪种操作系统。如果您使用的是ubuntu,则必须启用mod rewrite。@sonamgupta Windows 8.1在添加了我使用的htaccess以及更多htaccess的链接后,请尝试我的.htaccess代码。请参见:例如:如果标准解决方案不起作用,验证mod_rewrite是否启用在您放置代码的文件夹htaccess文件中您是否引用了我提供的链接和“向下投票者”我已尝试了下拉列表中的所有可用选项,并在它们不起作用后发布了问题。