CodeIgniter:删除' index.php'来自URL

时间:2015-06-19 08:15:21

标签: php .htaccess codeigniter tankauth

我之前已回答过这个问题,甚至自己也给出了答案。我尝试了大部分已回答的问题,但它仍然没有奏效。第一个问题是关于 Context context=null; ViewGroup parent=null; LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(R.layout.view_user_entry, parent, true); LinearLayout bg = (LinearLayout) v.findViewById(R.id.wrapper); bg.setBackgroundResource(R.drawable.bubble_yellow); 文件的放置,我应该将其保存在应用程序文件夹中还是放在其中?接下来的问题是'我该如何从网址中删除.htaccess

.htaccess代码:

index.php

Config.php代码:

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

如果可能的话,还建议一个关于如何自定义TankAuth或任何其他认证库的详细教程。我使用的是Windows 8.1和Wamp Server。

感谢任何建议或帮助。

7 个答案:

答案 0 :(得分:1)

它适用于我,顺便使用v2.2.6

  • 在与index.php相同的目录上创建.htacccess
  • 修改/application/config/config.php
  • 中的index_page和base_url值

这就是它的样子

picture image link

答案 1 :(得分:0)

在.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]


有关更多详细信息,请参阅链接:https://ellislab.com/expressionengine/user-guide/urls/remove_index.php.html

答案 2 :(得分:0)

试试这个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 https://github.com/riwakawebsitedesigns/htaccess_for_codeigniter

答案 3 :(得分:0)

enter image description here

Files.readAllBytes(Path file);

应用程序> config>的config.php

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

肯定会起作用。

答案 4 :(得分:0)

我认为它会对你有帮助,

的.htaccess

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

在config.php中

    $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'] = '';

由于

答案 5 :(得分:0)

<{1>}中的

更改此

warning('off','MATLAB:serial:fscanf:unsuccessfulRead');

.htaccess (注意:这应该放在应用程序文件夹之外)

s = serial('COM3');

set(s,'Timeout',1);       % sets timeout to 1 second (default is 10 seconds)

fopen(s);

warning('off','MATLAB:serial:fscanf:unsuccessfulRead');
in = fscanf(s);
warning('on','MATLAB:serial:fscanf:unsuccessfulRead');

if(in == 'A')
    fclose(s);
    break;
end
  

注意:有很多重复的问题。因此,在询问新问题之前,请检查您的下拉菜单(当您开始输入问题的标题时,它会随附)是否存在或提供答案。

答案 6 :(得分:0)

1.config.php

$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]