Configuration of . htaccess not working

Asked

Viewed 899 times

-4

Hello, I’m trying to set up htaccess, but it’s not working. The htaccess file is this

RewriteEngine On

RewriteRule ^$ /desenvolvimento/uniseries/site/
RewriteRule ^index$ /desenvolvimento/uniseries/site/index.php
RewriteRule ^livros$ /desenvolvimento/uniseries/site/livros.php
RewriteRule ^humor$ /desenvolvimento/uniseries/site/humor.php
RewriteRule ^diversos$ /desenvolvimento/uniseries/site/diversos.php
RewriteRule ^contato$ /desenvolvimento/uniseries/site/contato.php
RewriteRule ^series$ /desenvolvimento/uniseries/site/series.php
RewriteRule ^filmes$ /desenvolvimento/uniseries/site/filmes.php
RewriteRule ^entrevistas$ /desenvolvimento/uniseries/site/entrevistas.php

Something missing to set up? Remembering that I use several folders, this would be the site, admin does not, only this page, I know it works, because I hired a programmer to do for me, only that in other projects I am not able to configure. Could you help me?

  • What is the site root folder? For example: http:/localhost/ or http:/localhost/seu_site/

  • Already checked if apache mod_rewrite is enabled?

2 answers

0

You can do as follows by removing the / from the beginning if your site is not at the root, because when you put the / at the beginning refers to the root of the site, so for example:

http://localhost/development/uniseries/website/

And when it is not placed, it refers to the relative url taking into account the folder where . htaccess is located:

http://localhost/seu_site/development/uniseries/website/

.htaccess

RewriteEngine On

RewriteRule ^$ desenvolvimento/uniseries/site/
RewriteRule ^index$ desenvolvimento/uniseries/site/index.php
RewriteRule ^livros$ desenvolvimento/uniseries/site/livros.php
RewriteRule ^humor$ desenvolvimento/uniseries/site/humor.php
RewriteRule ^diversos$ desenvolvimento/uniseries/site/diversos.php
RewriteRule ^contato$ desenvolvimento/uniseries/site/contato.php
RewriteRule ^series$ desenvolvimento/uniseries/site/series.php
RewriteRule ^filmes$ desenvolvimento/uniseries/site/filmes.php
RewriteRule ^entrevistas$ desenvolvimento/uniseries/site/entrevistas.php

0

There are a number of factors that should be considered, but try it this way to see if it will work:

RewriteEngine On
RewriteRule ^(.+)$ desenvolvimento/uniseries/site/$1.php [QSA,L]

Browser other questions tagged

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