Printer Friendly Version Print this thread
Email this thread to a friend eMail this thread to a friend
  • Using Robots.txt on Your Web Site (In: General Search Engine Optimization)
  • Featured Web Site Template

    Hundreds More at Free Site Templates.com!

    Web Site Partners
    Sponsored Links
    Jet City Software
     
    Whos Here ?
    There are 0 guests and 1 members in the forums right now.
    Reflects user activity within the last 5 minutes
    Moderator(s): Prowler, jcokos
    Member Message

    butbut
    Joined: Jan 10, 2005
    # Posts: 19

    View the profile for butbut Send butbut a private message

    Posted: 2005-Jan-10 12:28
    Edit Message Delete Message Reply to this message

    Hello...
    i'm new on this forum and also with the 301 redirect.
    I've created a .htaccess file for a UNIX server.

    My problem is this:
    What i read is that i can make this file with a normal Notepad (creating a .txt file)
    What i also read is that the .htaccess file is not allowed to have any extention.

    What can i believe. And how can i create a .htaccess file without .txt extention, and how will i change a file without extention after i've created it.

    Thanx in advance

    Koen



    bhartzer
    Staff
    Joined: Jun 08, 2000
    # Posts: 7042

    View the profile for bhartzer Send bhartzer a private message

    Posted: 2005-Jan-10 16:06
    Edit Message Delete Message Reply to this message

    The file must be named .htaccess -- no .txt extension. You can ftp it to the server with any filename you want--even with a .txt extension. But you need to rename it .htaccess in order for it to work properly.



    g1smd
    Staff
    Joined: Jul 28, 2002
    # Posts: 10418

    View the profile for g1smd Send g1smd a private message

    Posted: 2005-Jan-10 19:01
    Edit Message Delete Message Reply to this message

    Save it in Windows from notepad or wordpad as ht.txt or whatever you want.

    Use FTP to upload it to your webserver (it must be an Apache server).

    Once uploaded, right click the filename and rename it as .htaccess
    Yes, that is right: dot htaccess




    lizardz
    Joined: Nov 12, 2004
    # Posts: 1394

    View the profile for lizardz Send lizardz a private message

    Posted: 2005-Jan-10 21:31
    Edit Message Delete Message Reply to this message

    I've found notepad is a very bad product to use for things like this, I've seen it insert invisible Microsoft characters into the code, which are only visible once you view it in a real ascii text editor.

    Do yourself a favor and don't use either notepad or wordpad. You can get a very good free html/code editor, there are many, one good one is called crimson editor [get it here]. It will save your files exactly the way you tell it to, and it has many other cool features, like code indentation, syntax highlighting, and so on. There's lots of good options out there, but notepad isn't one of them.



    g1smd
    Staff
    Joined: Jul 28, 2002
    # Posts: 10418

    View the profile for g1smd Send g1smd a private message

    Posted: 2005-Jan-10 23:38
    Edit Message Delete Message Reply to this message

    The "invisible characters" that you mention are probably CR and LF (carriage return and line feed) which windows uses, but Unix and Linux does not use. It only uses one of them (can't remember which one it is though).

    If you save a text file from a Windows application, each line will have CR and LF at the end. The CR LF forces a new line and a return to the left margin for the next piece of text. If you FTP the file to the server in ASCII mode then the server will change the CR LF into linux conventions instead (that is why a text or HTML file is always shown with a smaller byte size on an Apache server than the file size that Windows reports in Windows Explorer, or in the file properties box). If you transfer the text file as binary, then the previously invisible control character that the server does not use will appear as a blob instead, because the file will not have been "converted". Sometimes when you View Source" all of the lines of code are double-spaced. That is a related problem, too.

    The reverse is also true. If you FTP a binary file (image or .exe for example) in ASCII mode, then any part of the file that has the "unneeded character" (unneeded if it were an ASCII file that is) in it will be corrupted. Hence the images you sometimes see that are corrupted part way through, and then right the way through to the end.

    [ Message was edited by: g1smd 01/10/2005 03:52 pm ]





    lizardz
    Joined: Nov 12, 2004
    # Posts: 1394

    View the profile for lizardz Send lizardz a private message

    Posted: 2005-Jan-10 23:48
    Edit Message Delete Message Reply to this message

    No, it wasn't what you're describing, I'd actually never seen this before, it was because the person working on php script hit some keycombination, nothing was visible on the page, but the script failed. When I took a look at it in a real text editor I immediately saw the character, it's one of those weird ones that are made out of two characters, it was at the beginning of the line, invisible in notebook, but right before the <?php, which caused a 'header already sent' error on the script.

    As always, my conclusion was and is, don't use MS products for web work. I could give more horror stories about MS products and their bugs, but I won't. I just don't use them, and everything is just fine, the mistakes I come across are mine, I can deal with those.

    In this case, where the question is creating an .htaccess file, I would never use notepad for that, because it doesn't like the extension with no file name, it's just not a product that should touch code as far as I'm concerned. Since crimson editor is like 50 times better than notepad, and free, why bother?



    lizardz
    Joined: Nov 12, 2004
    # Posts: 1394

    View the profile for lizardz Send lizardz a private message

    Posted: 2005-Jan-10 23:57
    Edit Message Delete Message Reply to this message

    <very weird forum bug, how did that happen?>



    g1smd
    Staff
    Joined: Jul 28, 2002
    # Posts: 10418

    View the profile for g1smd Send g1smd a private message

    Posted: 2005-Jan-10 23:57
    Edit Message Delete Message Reply to this message

    Windows cannot save a filename like .htaccess at all. It is not a valid filename in the Windows OS. No application can save that name. It has to be called something else to save it to disk, and then renamed after it has been uploaded to the (Apache) webserver.



    lizardz
    Joined: Nov 12, 2004
    # Posts: 1394

    View the profile for lizardz Send lizardz a private message

    Posted: 2005-Jan-11 00:01
    Edit Message Delete Message Reply to this message

    Hmm. That would be an interesting observation if it were true, which it isn't. I work on windows, I've worked on windows for many years, and all my .htaccess files are functional in windows, and are saved as such. You are making some type of mistake, unless this is some weird windows 98 thing, I could double check that, but you are most definitely wrong, do you want me to send you an .htaccess file, I have many, a large collection, all on my windows box, some running through apache, some not. Careful in saying things that are simply incorrect, I hope you haven't been working under this assumption like that for the last few years, lots of needless work, bummer.

    .htaccess files also work fine on linux, and unix systems. I don't know about dos, they probably don't work there due to the lack of something before the .


    For anyone reading this thread: .htaccess files work fine on windows. There is no problem creating .htaccess files on windows. However, make them with a real text editor, that's a good habit to get into anyway, once you work with line numbering, syntax highlighting, indentation etc, you will wonder what it is exactly that made you think using notepad was a good idea. Plus most text editors are really small programs, very lightweight. My personal favorite is edit plus, crimson editor is a sort of clone of editplus, editplus costs a little bit, crimson editor has a few fewer features but is free.

    I can think of only one way windows would give you problems with a name like .htaccess, and that's if the default file name viewing options had been left [no file extension]. But even then that wouldn't affect how windows itself works. Once you figure out what you've been doing wrong let me know, that's an interesting one.

    [ Message was edited by: lizardz 01/10/2005 04:15 pm ]




    You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
    1. You have not yet logged in, or registered properly as a member
    2. You are a member, but no longer have posting rights.
    3. This is a private forum, for which you do not have permissions.

    If you are a recent member, it's possible that you simply have not yet confirmed your account. Please check your email for a message entitled 'JimWorld Forums: Confirm Your Account' and follow the instructions contained within.

    If you cannot find this message, click here to Re-Send it.

    If you are still experiencing problem, please read the Login Assistance Article for some advice on what may be causing your login not to work properly.

    Switch to Advanced Editor and ... Create a New Topic or Reply to this Thread

    New posts Forum is locked
    © 1995  ·  iWeb, Inc  ·  DBA JimWorld Productions