P
P
postya2019-08-07 14:55:42
symfony
postya, 2019-08-07 14:55:42

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

1 answer(s)
F
Flying, 2019-08-07
@postya

I will assume that you are using nginx as a web server within Open Server.
If so, in this case the public/.htaccessfile 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 question

Ask a Question

731 491 924 answers to any question