Apache refusing to serve with you don’t have permission to access error
Here are things to fix the problem
Have your config in your apache config like this:
require all granted
1. Make sure the directory you are accessing has at least 755 permission mode
2. Make sure to restart the server after you change the configs
3. Check if you have .htaccess file with different setting
4. In some cases, make sure the directory is accessible by apache – www-data.
How to redirect to home page on page not found 404
If you have a page that is not found, then google and others will penalize your site for not finding the page. Hence, you should handle that internally.
At least the easiest thing one can do is to redirect the site to the home page using .htaccess directives.
Homepage redirection 404
First create a .htaccess file if you don’t have one yet. Place this .htaccess file in the root of the website.
Then add the following line in the .htaccess file.
#if you have other redirect rules, have them here
#put this at the end of the file.
ErrorDocument 404 /
Mind you, the page you are going to redirect to should be relative path.
On the above file, those starting with # are comments and won’t be read by the server.
Hope it helps. Let me know if this helps you or if you have better method by leaving the comment down.
Time to ship your symfony app to production? Here are some flight checks. Lets assume your symfony app is in folder symfony-app
1. Don’t put Symfony app in the public accessible folder on your server
If your servers public facing folder is, say, /var/www/html, then don’t put the whole symfony folder there.
Choose another deeper and non-public facing folder. Let say /apps/symfony-app. I will list how you would put the public facing folders later.
For this to happen run this command on your server
2. Pushing your code to production server
You can use FTP client like filezilla or cyberduck and put your code in /apps
If you are using git, then you can clone your app like this
git clone https://firstname.lastname@example.org/username/symfony-app.git symfony-app
Continue reading Deploying Symfony on Production Server
OK, the ultimate wisdom is you will put your index file on the webserver accessible directory and your website would be visible – right? Well, not all the time.
Apache might decide to list your files even though you put your index.php in the directory you are expecting..
The thing lies on the default configuration of your server. If the default http.conf file has the directory setting to list then it will list even in the virtual hosts.
The fix Add your DirectoryIndex
So typical .htaccess or your setting in http.conf file would look like
...you other configs
DirectoryIndex index.php //or whatever you want it to start from
....your other configs