html - apache2 adding new website -


i'm pretty new apache. want create website hosting apache, here did: created new folder in /var/www/html named 'test' put index.html, js , css files in new folder

then tried access website localhost/test, html page displayed, cannot access js , css files. in console says "networkerror: 404 not found - http://localhost/main.js" why '/test' missing url?

my index.html has <script type="text/javascript" src="main.js"> can figure out what's wrong?

update checked dir.conf , added 'directoryslash on', looks like: <ifmodule mod_dir.c> directoryindex index.html index.cgi index.pl index.php index.xhtml index.htm directoryslash on </ifmodule> noticed when try access http://localhost/test adds '/' end, i'm still getting same error.

when use url relative path, computed relative last / in url relative to.

since visiting:

http://localhost/test 

test trimmed, , main.js added.

if @

http://localhost/test/ 

then last / @ end, resolve http://localhost/test/main.js.


apache redirect /test /test/ if test directory (specifically avoid problem). should edit configuration files enable the directoryslash directive:

directoryslash on 

that's default, must have version disabled.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -