.htaccess select file and not the folder

0

I have in the root of the site the .html files "index, services, gallery and contact". I also have a folder that is called "services".

I'm trying to use this code to leave url's friendly:

    RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f

RewriteRule ^(.*)$ $1.html

However, when I type the url "www.mydomain.com/servics" instead of opening the file servicos.html it is trying to access the folder with the same name (services).

Can anyone help me with this?

ps :. inside the folder services I have other .html files with the subjects about the services, which will be accessed by other links.

example: "www.mydomain.com/services/servico1", "www.mydomain.com/services/servico2"

    
asked by anonymous 10.12.2018 / 23:59

1 answer

0

do so:

<IfModule mod_rewrite.c> 
 RewriteEngine on



RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] 
</IfModule> 

And throw everything to php, so get php from url and creating a comparison condition by requesting a certain file in your directory.

Because of the way your htacess is taking any name and transforming it into .html

    
11.12.2018 / 00:12