Home .htaccess does not work .htaccess

does not work .htaccess

Author

Date

Category

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

Here are the Apache settings from the httpd.conf

settings

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
& lt; ifmodule unixd_module & gt;
  User Daemon.
  Group Daemon.
& lt; / iFModule & gt;
Serveradmin [email protected]
ServerName Localhost.
Documentroot "C: / Server / Data / Htdocs /"
& lt; directory / & gt;
  Options Includes Indexes FollowSymlinks
  AllowOverride All.
  ALLOW FROM ALL
& lt; / directory & gt;
& lt; Directory "C: / Server / Data / Htdocs /" & gt;
  Options Indexes FollowSymLinks.
  AllowOverride All.
  ALLOW FROM ALL
& lt; / directory & gt;
& lt; ifmodule dir_module & gt;
  DirectoryIndex index.html index.htm index.shtml index.php
& lt; / iFModule & gt;
& lt; files ".ht *" & gt;
  Require All Denied.
& lt; / files & gt;
ErrorLog "Logs / error.log"
Loglevel Warn.
& lt; ifmodule log_config_module & gt;
  Logformat "% h% l% u% t \"% r \ "% \"% b \ "% {referer} i \" \ "% {User-Agent} i \" "Combined
  Logformat "% h% l% u% t \"% r \ "% & gt; s% b" COMMON
  & lt; iFModule Logio_Module & gt;
    Logformat "% h% l% u% t \"% r \ "% \"% b \ "% {referer} i \" \ "% {User-Agent} i \"% i% o "Combinedio
  & lt; / iFModule & gt;
  CustomLog "Logs / Access.log" Common
& lt; / iFModule & gt;
& lt; iFModule Alias_Module & gt;
  Scriptalias / CGI-BIN / "C: / Apache24 / CGI-BIN /"
& lt; / iFModule & gt;
& lt; Directory "C: / Apache24 / CGI-BIN" & GT;
  AllowOverride none
  Options none
  Require all granted
& lt; / directory & gt;
& lt; iFModule Mime_Module & gt;
  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
& lt; / iFModule & gt;
& lt; ifmodule proxy_html_module & gt;
  Include conf / extra / proxy-html.conf
& lt; / iFModule & gt;
& lt; ifmodule ssl_module & gt;
  SSLRANDOMSEED STARTUP BUILTIN.
  Sslrandomseed Connect Builtin.
& lt; / iFModule & gt;
Phpinidir "C: / Server / Bin / PHP"
AddHandler Application / X-Httpd-PHP .php
LoadModule PHP5_Module "C: /Server/Bin/PHP/PHP5APACHE2_4.dll"

Here is the link to full config

Here are the contents 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?


1, Authority 100%

First of all, you need to check if htaccess is processed. To do this, keep it with any text that does not make sense. If you get a 500-error, the file is processed.

Next you need to check the server headers, for example, using https://bertal.ru/ or Google Chrome developer tools – Tab Network. It is quite possible (on hosting) that in the headlines of the answer as a server you will not see Apache, but nginx. Then you need to watch as nginx configured. As a rule, it can search for the requested links physically in the file system.


2, Authority 100%

In your configuration, it is not specified as will be called AccessFile, you need to add “AccessFileName .htaccess” in the Apache config.


3

and so?

rewritecond% {the_request} ^ [a-z] {3,9} \ / index \ .php \ http /
  Rewriterule ^ index \ .php $ http://site.ru/ [r = 301, l]

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions