2016-11-20 126 views
2

我的本地服務器上有一個sipmle php應用程序。我正在使用xampp。我正試圖從我的網址中刪除index.php。我在互聯網上查了很多文章,文件和問題,並嘗試了所有這些,但都沒有奏效。這裏是我的.htaccess文件:Codeigniter Xampp刪除index.php

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

,我已修改了config.php文件這些行:

$config['index_page'] = ''; 
$config['uri_protocol'] = 'REQUEST_URI'; 

和修改httpd.conf中:

ServerName localhost:8080 

# 
# Deny access to the entirety of your server's filesystem. You must 
# explicitly permit access to web content directories in other 
# <Directory> blocks below. 
# 
<Directory /> 
    AllowOverride none 
    Require all denied 
</Directory> 

...

DocumentRoot "C:/Projeler" 
<Directory "C:/Projeler"> 
    # 
    # Possible values for the Options directive are "None", "All", 
    # or any combination of: 
    # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews 
    # 
    # Note that "MultiViews" must be named *explicitly* --- "Options All" 
    # doesn't give it to you. 
    # 
    # The Options directive is both complicated and important. Please see 
    # http://httpd.apache.org/docs/2.4/mod/core.html#options 
    # for more information. 
    # 
    Options Indexes FollowSymLinks Includes ExecCGI 

    # 
    # AllowOverride controls what directives may be placed in .htaccess files. 
    # It can be "All", "None", or any combination of the keywords: 
    # AllowOverride FileInfo AuthConfig Limit 
    # 
    AllowOverride All 

    # 
    # Controls who can get stuff from this server. 
    # 
    Require all granted 
</Directory> 

感謝提前。

回答

0

嘗試用這種.htaccess

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

我試過了,但沒有奏效。 –

0

我使用這個htaccess的窗戶下面XAMPP

項目>的.htaccess提出申請folde的確認文件出方

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['base_url'] = 'http://localhost/project/'; 

$config['index_page'] = ''; 

更多htaccess在這裏https://github.com/wolfgang1983/htaccess_for_codeigniter