Does not work.htaccess

Redirection of all requests to index.php and it gives an error, as I understood, the problem is that apache does not take into account the settings of my file .htaccess.

Here are the apache settings from the httpd.conf settings file

ServerRoot "c:/Server/bin/Apache24"

Listen 80

LoadModule access_compat_module modules/mod_access_compat.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so

<IfModule unixd_module>
    User daemon
    Group daemon 
</IfModule>

ServerAdmin [email protected]
ServerName localhost

DocumentRoot "c:/Server/data/htdocs/"


<Directory />
    Options Includes Indexes FollowSymLinks
    AllowOverride All
    Allow from all
</Directory>

<Directory "c:/Server/data/htdocs/">
    Options Indexes FollowSymLinks
    AllowOverride All
    Allow from all
</Directory>

<IfModule dir_module>
    DirectoryIndex index.html index.htm index.shtml index.php
</IfModule>

<Files ".ht*">
    Require all denied
</Files>

ErrorLog "logs/error.log"

LogLevel warn

<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    CustomLog "logs/access.log" common
</IfModule>

<IfModule alias_module>
    ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/"
</IfModule>

<Directory "c:/Apache24/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>

<IfModule mime_module>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps

    TypesConfig conf/mime.types

    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
</IfModule>

<IfModule proxy_html_module>
    Include conf/extra/proxy-html.conf
</IfModule>

<IfModule ssl_module>
    SSLRandomSeed startup builtin
    SSLRandomSeed connect builtin
</IfModule>

PHPIniDir "C:/Server/bin/PHP"
AddHandler application/x-httpd-php .php
LoadModule php5_module "C:/Server/bin/PHP/php5apache2_4.dll"

Here is a link to the full config

Here is the content of htaccess

AddDefaultCharset utf-8

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php

Tell me, what is the problem?

Author: VenZell, 2016-01-03

4 answers

The first step is to check whether htaccess is being processed. To do this, you need to save it with any text that doesn't make sense. If you get the 500th error, the file is processed.

Next, you need to check the server headers, for example, using https://bertal.ru/ or Google Chrome Developer Tools - Network tab. It is quite possible (on hosting sites) that in the response headers, you will see nginx as the server, not Apache. Then you need to see how nginx is configured. How usually, it can search for the requested links physically in the file system.

 1
Author: Vasin Yuriy, 2019-01-06 05:24:51

Your configuration does not specify what the AccessFile will be called, you need to add "AccessFileName. htaccess"in the apache config.

 1
Author: Miomoor, 2019-10-16 12:06:19

And so?

    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
    RewriteRule ^index\.php$ http://site.ru/ [R=301,L]
 0
Author: Arcadiy, 2016-01-03 14:06:28

I also had this problem. But I decided. I found two ways:

  1. This is decided by the hosting service. If they do not want to or can not, then you need to change the hosting.
  2. Before the controller name, add index.php. For example:

    base_url().'index.php/controller_name/function_name';
    

    Also, just in case, here is the contents of my file .htaccess:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
RewriteBase /siteroot/
 0
Author: Жаздеми, 2019-08-08 09:12:21