A
A
Argentium2020-03-06 03:00:21
htaccess
Argentium, 2020-03-06 03:00:21

How to fix .htaccess (access denied) problem?

Hello, I'm trying to follow the link and remove the .php extension from the browser line. I do it through .htaccess, here is the code:

# Запускаем движок замены

RewriteEngine on

 # Если запрашиваемый объект не папка

RewriteCond %{REQUEST_FILENAME} !-d

 # если запрашиваемый объект с дописанным расширением php - файл

RewriteCond %{REQUEST_FILENAME}\.php -f

 # делаем замену с дописыванием .php

RewriteRule ^(.*)$ $1.php


Then I specify the path to the file in the links: My signup.php file is located in the pages folder, and the links are called from the index.php root folder. But when I click on the link, it redirects me to a page and says ACCESS DENIED. Perhaps it does not read the file as a file, but as a folder... WHAT TO DO? I'm testing on a local OpenServer machine. <a href="pages/signup">Регистрация</a>

5e61925241643171720232.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AUser0, 2020-03-06
@AUser0

And do this:
RewriteRule ^(.*?)/?$ $1.php [L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question