403 forbidden on React for just one url

English + Español
/ ENG ---->
Today, I ran into a very silly error on my React-made website, but I'm going to document the solution here because I couldn't find anything when searching on the internet.
It turns out that one of the web URLs is 'blocked.' When we refresh the page or type the address into the browser, the server returns a 403 error. However, when we navigate to that page through the web menu or links, the page loads perfectly. Furthermore, the rest of the web pages work fine, not just the home page, but all URLs except that one can be refreshed and accessed directly without using links.
We have already checked that the route is properly set up in React Router Dom, and the .htaccess file is configured to redirect all requests to the main page, but the page is still blocked. So, where is the problem?
SOLUTION:
In my case, the problem is that there is a folder in the root directory with the same name as the route I'm trying to access. In other words, I have a folder named characters
in the root directory, and I'm trying to access the URL www.mywebsite.com/characters
The server interprets that you want to access that folder and blocks access. The solution is quite simple: I renamed the folder, and now the page loads perfectly.
/ ESP ---->
Hoy me he topado con un error muy tonto en mi web hecha con React, pero voy a plasmar aquí la solución porque no he encontrado nada cuando buscaba en internet.
Resulta que una de las urls de la web está 'bloqueada', cuando refrescamos la página o buscamos la dirección en el navegador, el servidor devuelve un error 403. Sin embargo, cuando navegamos a esa página a través del menú de la web o de enlaces la página carga perfectamente. Además, el resto de páginas de la web funcionan bien, no sólo la de inicio si no todas las url's excepto esa se pueden refrescar y acceder directamente sin usar enlaces.
Ya hemos comprobado que la ruta está bien establecida en React Router Dom y que el archivo .htacces está configurado para redirigir todas las peticiones a la página principal, pero aún así la página sigue bloqueada. Entonces ¿dónte está el problema?
SOLUCIÓN:
En mi caso, el problema es que existe una carpeta en el directorio raíz que tiene el mismo nombre que la ruta a la que estoy intentando acceder. Es decir, tengo una carpeta llamada personajes
en el directorio raíz y estoy intentando acceder a la url www.miweb.com/personajes
El servidor interpreta que quieres acceder a esa carpeta y bloquea el acceso. La solución es bien sencilla, he cambiado la carpeta de nombre y ahora la página carga perféctamente.
Subscribe to my newsletter
Read articles from Said Sel-lam directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
