1
In short, it only works if I put index.php in the URL. I think it’s in . htaccess, but I don’t know where. I wonder which configuration is incorrect or what could I do to find my error.
Data: Debian(9) Apache/2.4.25 (Debian) PHP 7.0.19-1
My . htaccess:
<IfModule mod.rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [NC, L]
</IfModule>
My index.php:
<?php
$url = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
echo $url;
//tentativa diferente
$R = filter_input(INPUT_SERVER, 'REQUEST_URI');
echo $R
Terminal:
$ systemctl status apache2.service
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2017-10-28 12:30:05 -02; 1h 8min ago
Process: 768 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
$ a2enmod rewrite
Module rewrite already enabled
Thanks @tom-Melo, your . htaccess worked. By comparison and testing I might find the error, my apache is not accepting two tags in the command within . htaccess, such as
[NC L]
or[QSA L]
. I don’t know what there is but for now I just need the [L] tag. If someone knows how to set this up, please teach us, it might be useful in the future.– Web Sailor