2016-11-20 2 views
2

У меня есть приложение sipmle php на моем локальном сервере. Я использую xampp. Я пытаюсь удалить index.php из моих URL-адресов. Я проверил множество статей, документов и вопросов в Интернете и пробовал все, но никогда не работал. Вот мой файл .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

Смежные вопросы