Url Friendly . htaccess problem

Asked

Viewed 170 times

0

I have the following file . htaccess:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

ErrorDocument 404 /erro404
RewriteRule ^(.*)$ index.php?rota=$1 [L,QSA]

I am trying to put a condition that when the user enters the site.com/editor page he goes to the /editor folder instead of the index. I tried it like this without success:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

ErrorDocument 404 /erro404
RewriteRule editor /editor/index.php
RewriteRule ^(.*)$ index.php?rota=$1 [L,QSA]
  • Gives error or not found?

  • No, he carries the index.

1 answer

0


Flag missing [L], being like this:

RewriteRule editor /editor/index.php [L]

This flag means "last" (last). It means that if the rule matches, it will not check the others. Apache processes these rules as if they were a switch of a programming language and the flag [L] works like it’s the break.

  • It worked, thank you very much.

Browser other questions tagged

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