0

My directory structure is var/www/html and my website was installed in the html folder. I created a new directory called myfirstwebsite so now the directory structure is var/www/myfirstwebsite. I am doing this because I am trying to host two different websites using apache virtual host. I updated the httpd.conf to directory root /var/www and added Now the front page of the website loads perfectly fine, but the problem is none of the navigation links work (i get the error: requested url was not found on this server). Anyone have any idea what could be wrong here? I could really use the help.

  • Sounds like the .htaccess doesn't work. If you have access to httpd.conf make sure to remove .htaccess and copy all the settings into the vhost conf, so apache doesn't need to read .htaccess on every request. Cheap performance gain. – Fabian Blechschmidt Jul 15 '16 at 17:13
  • thanks for replying. i am still a beginner at a lot of this, i don't know much about .htaccess. I figured that might be the problem, my limited understanding is it somehow works with httpd.conf on allowing or denying access. So if you don't mind can i ask what you mean by remove .htaccess and copy which settings into vhost conf? – learning it Jul 15 '16 at 19:32
  • I'm not expert too about this, but I'll give it a try. – Fabian Blechschmidt Jul 16 '16 at 0:15
0

Apache knows at least two different types of configuration:

.htaccess

If apache is configured the right way, you can have a file called .htaccess which contains a lot of configuration settings. Have a look into magentos to get an impression.

The problem is, every time someone requests a page, apache is reading .htaccess (in case something changed). This is slow, but easy to update!

I think your problem is: To use an htaccess file, you need to define AllowOverride All.

More at digitalOcean

vhost configuration

The better thing is, to put all the configuration into the vhost configuration. The configuration file is read once, when the httpd(eamon) starts and then any changes are only used, if you restart the server (or at least reload the config).

Have a look into the documentation of apache, to know which is a vhost specific configuration and what needs a entry.

default

I assume there is some kind of default configuration, but no clue.

  • thanks now i know what AllowOverrride does. Unfortunately that wasn't the problem, still getting 404 error. I think this is the right path though, i'm sure there is something wrong with allowing access somewhere. – learning it Jul 16 '16 at 4:20
  • Just write "Allow Over ride" in the .htaccess if you then get a 503 you at least know, that it is read and parsed (not whether you are allowed to change things). But imho you get a 503 too, if you try to change things you are not allowed to. – Fabian Blechschmidt Jul 16 '16 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.