for example suppose I have a file "test index.html" and I want to set this as the index document for static website hosting, how do I do this? I've tried test index.html, "test index.html", test+index.html, test%2Bindex.html e
Asked
Active
Viewed 293 times
-5
-
5Just for background, why exactly is it important that you want to do this? Why can't you do index.html like virtually every other static website uses? – Tim Apr 02 '17 at 01:22
-
2Agreed. Spaces and HTML URLs don't get along well, and will only serve to make things difficult for your users. – EEAA Apr 02 '17 at 01:25
-
I have multiple test copies of the index, i happened to put a space in the name. Why have a box to specify the name at all if index.html is "virtually" the only way? – penchant Apr 02 '17 at 01:45
-
Anyhow this doesn't answer my question at all. Is it possible, and if so how does it work? As far as users go, it wouldn't matter because I'm setting it as the index document in an s3 bucket. A user would never type `blah.blah/test index.hrml` they would only type `blah.blah` and s3 would serve up the index document. – penchant Apr 02 '17 at 01:53
-
3There are literally millions of options for you to choose other than index.html that don't include a space in the name. Just rename the file. – EEAA Apr 02 '17 at 02:04
-
1I'm voting to close this question as off-topic because it's completely ridiculous. – Wesley Apr 02 '17 at 04:19
-
all i am asking is can I use a file that has a space in the name? I don't understand why that is an absurd question to ask. "no it is impossible" is a perfectly acceptable answer. I just want to know if it is possible and if so, how to do it. Why I should want to ought to be irrelevant.. – penchant Apr 04 '17 at 02:06
-
I just joined this community and I am starting to regret it. It feels very hostile, attacking a user's motives. I'm just trying to learn more about aws. good grief. – penchant Apr 04 '17 at 02:08
2 Answers
0
As of RFC3986 dictates:
URL encoding replaces unsafe ASCII characters with a "%" followed by two hexadecimal digits. URLs cannot contain spaces. URL encoding normally replaces a space with a plus (+) sign or with %20.
The relevant extracts about URL encoding can also be found at w3schools.org
-
neat. How do I make use of this with regards to what my question is asking, specifically, with aws s3 static website hosting configuration using the aws console? neither %20 or + seem to work – penchant Apr 08 '17 at 00:16
-
The answer is not a solution, but the proof that depicts your approach to the problem is wrong from start due to the fact that spaces (among other characters) are not supported in URLs and must be removed or escaped. If you want a direct solution, rename your files in S3 to remove special characters or, as many others have said along this thread, use escaped characters in your URL to bypass the limitations of the URL syntax. – ma.tome Apr 08 '17 at 09:25
-4
You would need to edit the webserver config and specify the index document. Your attempt to modify that directive was correct, you just used the wrong syntax - %20 is the URL code for a space - so instead of test%2Bindex.html
it would be test%20index.html
Or, if you are trying to get to it for testing purposes, then protocol://example.com/test%20index.html
ought to get it (or it does on my local apache install)

ivanivan
- 1,488
- 7
- 6
-
which webserver are we talking about? this is an s3 bucket static website configuration set in the aws console. – penchant Apr 02 '17 at 02:01
-
The index document directive is available on most webservers - it sets the file name that the server tries to locate if a request only specifies a directory in the URL. It can be a list of files, in an order of preference. From the wording of your question "set this as the index document" I assumed you have access to the web server configuration... If you do not have this access you'll have to use whatever the sysadmin has specified as default choices, OR include a file name with every URL. – ivanivan Apr 02 '17 at 02:04
-
@ivanivan your answer is incorrect. This is about Amazon S3, not a web server. – Tim Apr 02 '17 at 02:33