PDA

View Full Version : Calling an HTML file w/o extension?



drunkel
January 23rd, 2008, 11:58 PM
I have been looking around on W3C and other sites for an explanation on this but am still unclear.

I am trying to call a file which has a .html extension but without having to enter the file extension. Something like this:

http://www.mysite.com/myFile

Which should call myFile.html. From what I have read, it seems .html extension should be default on most http:// address or World Wide Web servers, correct?

I might just be out of my mind. Any help/explanation would be appreciated.

Thanks.

Templarian
January 24th, 2008, 12:10 AM
oh its simple just google htaccess mod rewrite or something like that... Your simply going to have a .htaccess file with a short string that basically says.

address.com/[anythingafterthis]

rewrites it to address.com/[anythingafterthis].html

this is actually server-side and requires an apache server.

drunkel
January 24th, 2008, 06:51 PM
Okay so two issues:

1. I made the file from tute's I found through Google:

RewriteEngine on
RewriteRule ^myFile$ myFile.html

Is this correct?

2. I am on Mac OS X using FireFox w/ Fire FTP Tool to upload files.

Neither of which will show hidden files such as .htaccess. So to combat this, I just made the file with another extension, .html.

Then once uploaded to server (Apahce) I renamed it to .htaccess? Is this right?


Thanks.

nobody
January 24th, 2008, 07:08 PM
As long as the file is called .htaccess once it's on the server you're good to go. Doesn't matter how you get there.

drunkel
January 24th, 2008, 09:03 PM
I couldn't figure anything out with the code above. I believe I understand it correctly, but all I kept getting was "500 Internal Server Error(s)".

drunkel
January 24th, 2008, 09:29 PM
Whatever, I got it to do what my boss wanted it to do (myFile/index.html)). Thanks for your help guys.