Symfony 404 errors
Solution 1
You'll need to do two things:
1) Ensure that mod_rewrite is enabled in Apache.
2) Double-check the .htaccess
file in the document root to make sure it is pointing to your app.php
. Something along the lines of:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
Solution 2
I used to have this problem too, please take a look at my configurations and try them out
inside my .htaccess:
Hi all, I have been having this problem too. And it seems that the "stock" .htaccess is the problem. I have solved this in my environment and here is my .htaccess with notes:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^app_dev.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L] ##### this is the part that you should tweak, have the .htaccess point the request to app_dev.php, since the routing.yml is empty initially
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]
RewriteRule .? %{ENV:BASE}/app_dev.php [L] ##### this is the part that you should tweak, have the .htaccess point the request to app_dev.php, since the routing.yml is empty initially
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
# When mod_rewrite is not available, we instruct a temporary redirect of
# the startpage to the front controller explicitly so that the website
# and the generated links can still be used.
RedirectMatch 302 ^/$ /app.php/
# RedirectTemp cannot be used instead
</IfModule>
</IfModule>
inside my "symfony" entry in /etc/apache2/sites-available:
<VirtualHost 127.0.1.15>
ServerAdmin webmaster@localhost
ServerName symfony
DocumentRoot /var/www/Symfony/web
DirectoryIndex app.php
<Directory /var/www/Symfony/web>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Related videos on Youtube
Carey Estes
I'm a UI/UX Designer, Frontend Dev, and Disc Golfer. I am not a professional at either.
Updated on June 04, 2022Comments
-
Carey Estes almost 2 years
On my local machine, the symfony project I have created works perfectly.
I have installed symfony on my testing server and it is working fine. When I go to the URL in the browser I get the "Symfony Project Created" page. I ran the check_configuration.php and everything checks out.
The problem I am having is: I have created my database and uploaded the table data. I have uploaded the files from my local machine to the server with FTP. When I try to access the module I created, it throws a 404 Error:
Not Found
The requested URL /mymodule was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Here's some examples:
On my local machine using MAMP, I use the following URL that works fine:
http://localhost:8080/frontend_dev.php/mymodule
After I have uploaded everything, if I go to the testing server URL:
http://my.url.com:8090/
I get the "Project Success" page with the /sf images and styles.
BUT If I try
http://my.url.com:8090/mymodule
I get the 404 error as if the page does not exist, which makes me thik smfony does not know about the frontend module.
Any Help?