Site malfunction after change in . htaccess

Asked

Viewed 53 times

0

For a site to get more url friendly I removed the .php using the following commands within the .htaccess:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^([^\.]+)$ $1.php [NC,L]

It worked perfectly for the.php news part, and the www.exemplo.com.br site opens without the need to add index.php. However, the problem is in the administrative panel, which makes it necessary to add index. Staying in this form:

www.exemplo.com.br/painel/index

or

www.exemplo.com.br/painel/index.php

How do I fix this? Access only with /dashboard/

Thank you!

2 answers

0

All that’s missing is the RewriteBase / leave your code like this:

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
  • I changed htaccess as you suggested but it hasn’t worked yet! I still can not access by www.exemplo.com.br/panel and only access via www.exemplo.com.br/panel/index

0

Hello,

I use this rule below to have that effect. I own a folder and within it a file index php. common.

Example:

www.meusite.com.br/Dashboard/new-registration/

  1. The Dashboard is a folder;
  2. The new register is a folder;
  3. Inside the folder new register has an index.php file
  4. In the .htaccess which is at the root of the project, there is the following rule:

    <IfModule mod_rewrite.c>
    RewriteEngine on
        RewriteCond %{HTTP_HOST} ^www.meusite.com [NC]
        RewriteRule (.*) https://hecato.com/$1 [R=301,L]
        RewriteRule ^([a-z0-9]+)/?$ index.php?user=$1 [NC,L]
        RewriteCond %{HTTP_HOST} ^(^.*)\.hecato.com
        RewriteRule (.*) index.php?user=%1
    </IfModule>
    


If not, I suggest you create another .htaccess inside the directory you want to create this rule (in this case, the /panel folder).

Any doubt we’re there.

I hope I’ve helped

Browser other questions tagged

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