I have the following problem, I have an application with the following structure:
- app - Folder to store project files as controllers and models.
- public_html - Stores public documents on the web, such as index, uploads, css.
- routes.php - Manages the routes of my project, called by index.php in the public_html folder
- .htaccess - "the problem"
I require that when a user accesses exemplo.com
, the request is redirected to my public_html
folder, in which case the index.php
of that folder would be triggered, and would include the routes.php
of the directory in the above level, but not I want the url to be exemplo.com/public_html/index.php
.
I also do not want to be able to access the url directly as exemplo.com/public_html
, that is, to avoid duplicate URLs like exemplo.com/index.php?pagina=1
and exemplo.com/public_html/index.php?pagina=1
, I would like that when someone does direct access to this page, it is redirected to exemplo.com
.
Notes : I use the Apache server in the Debian 8 distribution and I want to make these settings through .htaccess
, I have mod_rewrite
active and functional.
I did not mention any files from public_html
, but I think maybe I'll need settings in .htaccess
from there.
I want to implement friendly URLs too.
Could anyone help me solve this problem?