I'm new to creating webpages, so perhaps this is really easy and I just can't see it. I have a HTML/CSS template that I am modifying for a new site. When I check the index.html file locally (in Dreamweaver or in browsers) it appears correct. When I uploaded them to the server then the website does not load the images and it appears that the styles.css file is not loading correctly. I have attached a few screenshots to get the ball rolling. As always thanks for your assistance.
Desired Output:
Current Output:
This is likely (later confirmed by asker in comment) a file and directory access right problem.
This can be verified by checking the access logs of the http server.
The solution is to update the ownership and permissions of any problem files so that the http server has rights to them. In this case, it is probably the easiest to examine the permissions of the index.html file and related folders and apply the same permission to the problematic files/folders.
Related
I have been struggling with this all morning and I have not had much luck.
I am trying to get the following stackoverflow post to work: How to remove .html from URL
Here is my file directory with the htaccess file:
Here is my code that works fine using .html
So I went into sublime text and posted the same code into a .htaccess file as shown here (also in my directory first pic):
I then changed my links and removed .html
But I get an error
If anyone could please tell me what I'm doing wrong I would be grateful! Been bashing my head on this all morning
.htaccess is a file used to control access for Apache web servers. It won't affect anything unless you're running and accessing an Apache server. From your screenshots I can see that you're directly opening a file from your hard drive.
Your browser is saying File not found because you're trying to access a non-existent file. The address bar in your browser should say this:
file:///Users/mikegeng/Documents/GitHub/MichaelGeng.github.io/index.html
.htaccess is used by Apache Webserver. You must install and configure an Apache Webserver and access your site through http://localhost for example.
Currently your .htaccess is completely ignored until your site is served by Apache.
I have a XenForo board and I want to put some files on the system, for everyone to see. So I created a directory and uploaded files. When I am trying to access it though I am getting a 403 error Forbidden error in the browser. How can I fix that?
Htaccess file and check if there is an access restriction for the folder where the files are located.
I am running an Apache web server on a machine running Centos.
THE PROBLEM:
When I run the server, everything works fine and I can see the welcome page. The problem occurs when I try to put in an index.html file I previously created into the /var/www/html directory. When I do this I get the error: Forbidden you do not have permission to access index.html on this server. The weird part is I created an index.html file as root in this directory and it works. It was just a simple test html file:
<!DOCTYPE html>
<html>
<head>
<h1>Hello World</h1>
</head>
</html>
This works. So I tried copying the html text from the original index.html to the one I specifically created in the /var/www/html directory and that works. The only problem here is now I have to create lots of new files in the html folder and copy the contents of the old files into the new ones. Also, how would I get images to work? And Hence, my question. So what is the difference between moving files to a directory and creating them there?
Note
I know I have set the server up correctly because I am able to access it from another computer so I don't think there is an error with the httpd.conf file. Also, I am not using a .htaccess file. The permissions on each file is the same, only one works and one doesn't. The permissions I have tried are -rwxr--r-- and -rwxrw-rw- and -rwxr-xr-x. I have also changed the owner of the files to be the same. I have tried changing the owner to apache and to root. No luck.
Thanks for the help
Moving files retains the SELinux file context assigned to the file when it was created in its original location. Copying it recreates the file anew in the new location, giving it the appropriate file context for that location.
The appropriate file context can be restored on a directory and all files contained within by running restorecon against it. See the restorecon(8) man page for details.
I've made a simple web page for one of my classes, and uploaded it to an Apache server on campus, from which I'm to view and take a screenshot of.
Before trying to view the page I created a sub-directory on the server to put my HTML file. Once the upload was complete, I changed the permissions on the file to -rwx---r-x and on the sub-directory folder to drwx---r-x.
However, I'm not able to view the page. I keep getting a message saying 403: Forbidden. You do not have sufficient privileges to view this site on this server.
Is there anything else that I need to do to the file and/or folder to be able to view the web page?
Who is the owner and the group of the file?
You probably need to change the file permissions to -rwxr--r-- and directory to drwxr-xr-x
I'm having troubles serving a document which is in a higher level than my root folder.
<a href='../../home/folder/document.docx'>Proposal</a>
In the browser the above gets interpreted as:
http://localhost/home/folder/document.docx
I cannot see the browser going up in the folders and then the answer I get is:
Not Found
The requested URL /home/folder/document.docx was not found on this server.
I have tried in Firefox and Chrome, it happens the same. I am using Apache Web Server on a Linux machine.
Any help will be appreciated.
You can not redirect your visitors to a file outside of your document root (where you have your index.html).
People can't see files higher than where http://localhost/ ends up in.
A solution would be to put that .docx inside of your document root (where your index.html is in).
You can however let PHP serve the file using the readfile function.
But don't forget that www-data would need to have access to the file you're serving.