How to configure symfony app

Hi guys! I’ve already uploaded my symfony app via FTP in the subdirectory in htdocs directory. My problem is how I can access to my web app. I tried to access it via mydomain/project_dir but I always have an error. Could someone help me?

Thanks beforehand

What is your website’s URL, and what is the error you’re facing?
Can you share more information?

2 Likes

You can see below my file manager structure and the error when I try to access the website

1 Like

The error suggests that Symfony is loaded, but it doesn’t have any routes configured for the given URL. Do you have a route set up for that URL in your site’s Symfony configuration?

3 Likes

I have one route which is generated by using annotations (/admin). However , when I try to access the /admin route I have an error 404 no found

I think the issue is caused by your .htaccess setup.

I see you tried to make the public folder thing work by setting a DirectoryIndex in the .htaccess file in the htdocs folder. The project folder and the public folder themselves don’t have any .htaccess files.

The consequence is that /orange-debit-suivi/ will be routed to /orange-debit-suivi/public/index.php, which is OK, but /orange-debit-suivi/admin/ will be routed to /orange-debit-suivi/admin/public/index.php, which is not OK of course.

If you can make it work, good for you, but I would like to suggest a different route:

  1. Delete the .htaccess file in the htdocs directory. You don’t need it for your sub-project.
  2. Restore the original Symfony .htaccess file in the public folder. It contains configuration necessary for Symonfy to work.
  3. Create a new .htaccess file in the /orange-debit-suivi/ folder with this code: .htaccess for Laravel
5 Likes

Thanks for your response .
When I follow your suggestion , I have an 404 error. I don’t see what you mean about the .htaccess in public directory for symfony
Laravel and symfony are a little bit similar , I try it like laravel deployement but It doesn’t work for me

A default Symfony installation should have a .htaccess file in the public directory. I cannot find the official source for it, but this is one such file found in the official demo code: demo/public/.htaccess at main · symfony/demo · GitHub

This file is necessary to route any sub-URLs (like /admin) to the main index.php. Your site doesn’t have this file, so any URLs other than the home URL will not work.

Please restore the original Symfony .htaccess in the public directory in addition to the Laravel snippet in the project’s root directory.

3 Likes

Thanks a million , to generate this .htaccess file in public directory, I install the package symfony/apache-pack

At the moment, the site works fine!
I appreciate your help. Thanks

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.