404 Not Found Error

March 31, 2018 2.2k views
Apache Ubuntu 16.04

I installed LAMP stack and followed the following tutorials to make my droplet ready I installed Wordpress on main domain and PHP script on subdomain! Wordpress is working well but when i open the subdomain index.php file load well but when i click on Login/Signup Page it gives me "Not Found
The requested URL /app/login was not found on this server." ! Same script works fine on shared hosting and now i want to switch to VPS but encounter this error! I contacted the script developer he said it's due to .htaccess file not working or executed! System is using the default settiings and ignore the .htaccess file placed in subdomain! Please help me :')

Site Url:
alphafire.me
subdomain: alphafire.me/app

Tutorials Followed:
https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-16-04
https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-16-04
https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lamp-on-ubuntu-16-04

2 Answers

If your index.php file is loading properly on your php script but other pages are not this likely indicates an issue with your url redirects. On apache these are likely to be located in an .htaccess file in your web root.

In order for the redirects included in the .htaccess file to be used by Apache to route requests you need to ensure that your virtualhost configuration for this site uses:

AllowOverride All

rather than the default

AllowOverride None

This tells apache that it can use directives in the .htaccess file to override the default settings.

This answer on Stackoverflow solved the issue in my case:

"In case you are on Ubuntu, edit the file /etc/apache2/apache2.conf (here we have an example of /var/www):

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

and change it to;

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

then,

sudo service apache2 restart

You may need to also do sudo a2enmod rewrite to enable module rewrite."

Have another answer? Share your knowledge.