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.
Related
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.
I recently bought a website to play with, but I immediately had a problem.
My website doesn't load the index.html when I just connect to mydomain.com. If I write it manually (mydomain.com/index.html) everything works perfectly. I tried to change the .htaccess file to direct all traffic to my index.html page with the following line, but the problem remains:
DirectoryIndex index.html
Any ideas to solve the problem?
Please provide the web host and/or server type (windows, linux, etc) to help further answer your question.
As a start some web servers (windows/iis) expect different file names for the default html file. Godady.com has a list of different file names for Linux and Windows at this url: https://www.godaddy.com/help/what-file-displays-when-someone-browses-to-my-domain-name-60
Good luck!
This DirectoryIndex index.html has to be set in httpd.conf file. In your httpd.conf, you might have disabled .htaccess with AllowOverride none. That is why your .htaccess is not working
When trying to add a link to a downloadable .exe I encounter an error/notice:
'You do not have permission to access this document' instead of downloading it.
This is the anchor:
Here
Using this on .zip and .dmg work fine.
I've found something eslewere, suggestion to add exe|EXE and place this in the .htaccess:
Deny from all
<FilesMatch "\.(html|HTML|htm|HTM|xhtml|XHTML|js|JS|css|CSS|bmp|BMP|png|PNG|gif|GIF|jpg|JPG|jpeg|JPEG|ico|ICO|doc|DOC|docx|DOCX|txt|TXT|rtf|RTF|xls|XLS|xlsx|XLSX|csv|CSV|zip|ZIP|pdf|PDF|exe|EXE)$">
Allow from all
</FilesMatch>
This did not solve my problem, removing for example the PDF from this bit of code, did block the pdf download. But the other way around, adding the exe didn't enable the exe to be downloadable.
It is a WordPress install, but these downloads are not uploaded via WordPress, they are directly placed in the downloads folder.
Kind regards,
Martijn
After more searching, I found someone, posting a simular problem.
The suggested answer (settings with the hosting, not the actual code) there was not the solution.
But did set us on the right path.
Previously simular code was working, but on another server, with a different config.Current domain is done via the Plesk panel.
In the Plesk panel, under the Apache & nginx settings for the domain.
Checking the box: 'Serve static files directly by nginx' solved the issue for me.
Server gives a 404 error instead of serving up an index.php or index.html file on the www.domainname.com call. If I type in www.domainname.com/index.php it works fine, but not otherwise. This domain is an add-on domain to my existing cpanel installation, so I don't know if that is related. Permissions are set to execute on the file. I tried creating a .htaccess file in the directory with the following:
DirectoryIndex index.php
This did not work. Wondering how I can troubleshoot this. Running LiteSpeed Web Server on shared hosting. What could be causing this?
When I renamed .htaccess to .htaccess.bak in the parent directory, everything worked as expected. It seems there is probably an error in that .htaccess file that is propagating sub-directories as well. I will need to figure out exactly what is wrong, but that lies outside the scope of this question.
Was tipped off to the idea by: http://www.bluehostforum.com/showthread.php?38079-automatically-serve-index-html-in-subdirectories-solved
I have an OpenShift server running python. However when I call php via SSL the php interpreter starts running. It suggests that there might be a way to run php as well. However, HTML if fair enough for me. Now, I do not know how to be able to reach html files on my server as when I am trying I always get 404 not found. I've read about a solution of placing a .htaccess file:
AddType application/x-httpd-php .html
I am not exactly sure where to place this file but placing in the folder of the .html file still not helps.
Could you please help me how I can make .html files reachable at an OpenShift server running Python? How about php?
Put the .html file in your app-root/repo/wsgi/static folder (or in that folder in your git repository). if you want it to be displayed like app-domain.rhcloud.com/file.html, you will have to use a .htaccess file in your wsgi folder that rewrites file.html to static/file.html