.htaccess select file and not folder

Asked

Viewed 15 times

0

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

i am trying to use this code to let the url’s friendly:

    RewriteEngine On

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

RewriteRule ^(.*)$ $1.html

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

someone can help me with this ?

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

example: "www.meudominio.com.br/servicos/servico1", "www.meudominio.com.br/servicos/servico2"

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 it all to php, then take php the url and create a comparison condition by making the file requirement in your directory..

as this your htacess is taking any name and turning into . html

Browser other questions tagged

You are not signed in. Login or sign up in order to post.