1
I use a cloud server called Digital Ocean. However I am facing problems while trying to create friendly Urls. I have activated the module rewrite
through the command:
sudo a2enmod rewrite
and altered sudo nano /etc/apache2/sites-available/default
leaving so:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Only if, by chance, there is a file with the same name it does not pass through my .htacess
, irrespective of the extent
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ sessao.php [NC,L,QSA]
Here too is mine sessoes.php
:
$gets = explode("/",str_replace(strrchr($_SERVER["REQUEST_URI"], "?"), "", $_SERVER["REQUEST_URI"]));
for($i=1; $i<=count($gets); $i++) {
$var = "p$i";
$$var = addslashes($gets[$i]);
}
if (file_exists($p1.".php")) {
include("teste.$p1".".php");
} else {
header("Location: /");
exit();
}
Practical example of the situation:
If I call http://107.170.237.146/base
he carries the http://107.170.237.146/base.html
if you find the same, if you do not find it search http://107.170.237.146/base.php
, if you do not find it carries the sessoes.php
.
But I can verify that it always go through first sessoes.php
and then drop . html or in . php.
How can I make him first obey the .htaccess
?