Answer the question
In order to leave comments, you need to log in
How to change URL in Symfony?
Created a new Symfony project, created a HomeController controller.
If I go along the path
gallery/public/index.php/home
, then the controller works fine and the template appears, but I would like to avoid such a not-so-pretty url on the site and I would like the path to the template to be like this:
gallery/home
How can I change URL?
As I understand it, this is because the main Index.php file, the program entry point, is in the public package. But I don't want to change the project structure, just change the url . I
use Open Server as a server
Answer the question
In order to leave comments, you need to log in
I will assume that you are using nginx as a web server within Open Server.
If so, in this case the public/.htaccess
file that implements the rewriting fails. You need to configure nginx for it to handle link translation. An example of a config is in the official documentation .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question