Interception and redirection

0

My structure

localhost/sistema
localhost/sistema/.htaccess
localhost/sistema/site/index.php

Goal : When accessing any url within domínio , interceptação and redirecionamento occur to the index.php page that is in the localhost / system / site directory

attempt in .htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -t [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.$ - [NC,L]
RewriteRule ^.$ site/index.php [NC,L]

Result .

Erro 500

Where am I going wrong?

Note :

Line

LoadModule rewrite_module modules/mod_rewrite.so

uncommented link

e,

DocumentRoot "C:\Program Files\Apache24\Apache24/htdocs"
<Directory "C:\Program Files\Apache24\Apache24/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Apache log error:

htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

However, so is in the

    
asked by anonymous 12.06.2018 / 18:39

2 answers

0

I use something simpler, it works for what I need here, test it there

RewriteEngine On
# pasta base de referencia
RewriteBase /app
# Proteje pastas de serem acessadas diretamente
RewriteRule ^(classes|includes|logs) - [F,L]
# arquivo que pode abrir diretamente
RewriteCond %{REQUEST_URI} !(homologa.*.php)$
# qualquer outro arquivo e redirecionado para o index.php
RewriteRule . index.php
    
12.06.2018 / 20:17
0

Although it was a solution I did not approve. But what is to be done.

There should be recourse to this. But we will know soon.

The solution is:

<Directory />
    AllowOverride All
    #Require all alowed
</Directory>

That is, change to all Apache and not just localhost as the line below suggests

DocumentRoot "C:\Program Files\Apache24\Apache24/htdocs"
<Directory "C:\Program Files\Apache24\Apache24/htdocs">
    #
    # 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

    #
    # 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
    #

    #
    # Controls who can get stuff from this server.
    #
    AllowOverride All
    Order allow,deny
    Allow from All
</Directory>
    
12.06.2018 / 21:12