Problem with .htaccess ErrorDocument

1

I have a page of 404.php and the intention is that using .htaccess will take you to that page in case of error 404, but it does not work.

This is the htacccess file:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
ErrorDocument 404 /404.php
ErrorDocument 403 /404.php

This is the error that gives me:

Not Found

The requested URL /CBS/CBSLanguageAcademy/hi was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

I do not know why I get that error, I'm pretty bad with the .htaccess.

Does anyone have any ideas?

    
asked by Charlie Clewer 14.09.2017 в 19:11
source

2 answers

1

Problem solved

In the .htaccess you have to specify the exact path from where the main index of the domain is located. I mean, I have this structure:

wwww.unaprueba.com/enlaces/paginas/index.php

If the .htaccess file is where the Index.php of the pages folder is located, it does not work with putting only:

ErrorDocument 404 /404.php

You should put:

ErrorDocument 404 /links / pages / 404.php

I hope you have explained it correctly.

    
answered by 14.09.2017 / 19:57
source
-1
RewriteCond %{REQUEST_FILENAME}\.php -f

Put it this way

RewriteCond %{REQUEST_FILENAME}.php -f
    
answered by 05.08.2018 в 07:05