Website URL gives 404 error

Anna

I am just me
Staff member
Messages
11,733
Reaction score
578
Points
113
This was a permissions issue, I have now corrected that and the site works from my end now.
 

lotuscha

Member
Messages
33
Reaction score
1
Points
8
Anna, thank you... you are the best; you always come through with quick and excellent support.

I was able to access my domain (http://lotuschaser.x10host.com) as well as get to a directory/folder under my website (http://lotuschaser.x10host.com/stuff). However, having said that, I am not able to click on one of the images listed in that folder (http://lotuschaser.x10host.com/stuff/Mic_05.jpg) and see the image; I still get the 404 Error.

I assume that this is also a Permissions issue. Perhaps you could point me to a HELP resource that would explain the various permissions and how to implement them for individual Directories and Files. I thought I had it sussed with the .htaccess file but apparently I didn't.

Cheers,
Len
 

garrettroyce

Community Support
Community Support
Messages
5,611
Reaction score
249
Points
63
I can see that the folder exists by going to http://lotuschaser.x10host.com/stuff/ but clicking on the file in the list gives a 404. It looks to me like it could be something like url rewriting making a valid URL into a an invalid path. Are you using rewrite rules in a .htaccess file?
 

lotuscha

Member
Messages
33
Reaction score
1
Points
8
I can see that the folder exists by going to http://lotuschaser.x10host.com/stuff/ but clicking on the file in the list gives a 404. It looks to me like it could be something like url rewriting making a valid URL into a an invalid path. Are you using rewrite rules in a .htaccess file?

Garrett,

Thanks for the post. No, I am not using any rewrite rules in an .htaccess file; I don't even know what they are, LOL.
The only line in the file is "Options +Indexes".
 

spacresx

Community Advocate
Community Support
Messages
2,182
Reaction score
195
Points
63
If you use the file manager you can check file permissions easily.

by default the permissions should be like this:
'files' would be 644 and 'folders' would be 755

sometimes when uploading files those might get changed,
or for whatever reason you change them after they get uploaded.

if you do not want everyone to view the content of a folder,
add this to your .htaccess file:

#Options +Indexes
DirectoryIndex index.php
IndexIgnore *

i had trouble using Options +Indexes so i added the # before it,
the # ignores that line of code but lets me keeps it in case i need it.

the DirectoryIndex tells it what to look for by default.
in this case i tell it i have an index.php that is used.
change the DirectoryIndex to the one you have, index.htm, index.html etc.

the IndexIgnore * will hide the folder content so no one can view files.
this protects your content from being seen by anyone.
you can also add the # to the beginning of any line of code in htaccess
if you want it to be ignored.

any file links should still work.
 

lotuscha

Member
Messages
33
Reaction score
1
Points
8
If you use the file manager you can check file permissions easily.

by default the permissions should be like this:
'files' would be 644 and 'folders' would be 755

sometimes when uploading files those might get changed,
or for whatever reason you change them after they get uploaded.

if you do not want everyone to view the content of a folder,
add this to your .htaccess file:

#Options +Indexes
DirectoryIndex index.php
IndexIgnore *

i had trouble using Options +Indexes so i added the # before it,
the # ignores that line of code but lets me keeps it in case i need it.

the DirectoryIndex tells it what to look for by default.
in this case i tell it i have an index.php that is used.
change the DirectoryIndex to the one you have, index.htm, index.html etc.

the IndexIgnore * will hide the folder content so no one can view files.
this protects your content from being seen by anyone.
you can also add the # to the beginning of any line of code in htaccess
if you want it to be ignored.

any file links should still work.

Well that worked a charm, thanks for that! I can see the files now.

This is all smoke and mirrors for me at this point. If I wanted to limit viewing the contents, would I need a separate .htaccess file in each Directory?

As well, how would I prevent someone from clicking on the "Parent Directory" and walking back through the directory structure, instead just go back to the 'root' or main directory?
 
Last edited:

spacresx

Community Advocate
Community Support
Messages
2,182
Reaction score
195
Points
63
As well, how would I prevent someone from clicking on the "Parent Directory" and walking back through the directory structure, instead just go back to the 'root' or main directory?

there is many different ways to do that. 1 method that worked for me is this....
in the root .htaccess file you would have this in the file...

<Files .htaccess>
Order deny,allow
Deny from all
</Files>
#Options +Indexes
DirectoryIndex index.php
IndexIgnore *

then in the "other" directories .htaccess file you can put this ...

# protect contents of the .htaccess
<Files .htaccess>
Order deny,allow
Deny from all
</Files>
#
#redirect requests back to the original htaccess.
RedirectMatch 301 ^/stuff/$ http://lotuschaser.x10host.com
IndexIgnore *

Just change the 'stuff' above to the name of the directory the htaccess is in,
then any visitor would get redirected to the 'main' or 'root' htaccess file.
(in public_html folder) remember the # allows you to add comments for that line.
like i did for parts of the code.

note: linked images can still be viewed when the links are clicked.
there are lots of other things you can do in an htaccess file.
you would need to test or experiment a little to see what works for you.
ive spent years just testing stuff id find on the internet.
 
Top