Forum Moderators: phranque

Message Too Old, No Replies

Major problems uploading htaccess files

Solving weird problem with htacess

         

hatchez11

4:28 am on Aug 6, 2008 (gmt 0)

10+ Year Member



I recently hired a freelancer to write some rewrite rules for my htaccess file. She did, and they worked fine.

So far so good. But every time I upload any htmaccess file to my server -- even an exact copy of the htmaccess that was already working -- the rewrite rules stop functioning.

This general problem was happening before I even hired someone to work on the rewrite rules in my htaccess file. Every time I uploaded an htaccess file -- even if it contained no changes from the one that was there before it -- my site would often crash and I'd need my service provider to intervene (though, unfortunately, they were never very good at telling me how they fixed things, though they suggested that the hmaccess files was somehow corrupt).

Before anyone speculates on the reason(s) for my inability to upload htmaccess files without problems (or potential code corruption?), they should know that I've specifically requested my FETCH FTP program to upload such files in ASCII mode (even tho' it should be doing so already via its default auto mode)

I've also tried saving my htaccess file on TextEdit and on TextWrangler, both of which were set to ascii saving mode. I've even tried uploading the files through my service provider's file manager interface instead of through my FTP client.

Still, inevitably, the rewriting rules crap out on me after I upload my htmaccess file, even though the exact same file works fine when uploaded by someone else to the same place.

I've read many htaccess tutorials, but so far can see no sign as to why this is happening.

In case it matters, I have an Apple iBook 10.4.11, using FETCH ftp client, using Mac TextEdit & also TextWrangler.

jdMorgan

5:27 am on Aug 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You might want to check the file on your machine with a hex editor, and make sure that it does not start with a UTF-8 file marker or similar. Or try using the most basic plain-text editor that you can find that will output unix line-enders (linefeed-only).

Jim

hatchez11

3:51 pm on Aug 6, 2008 (gmt 0)

10+ Year Member



Thanks for the suggestion. I've downloaded a program called Hex Fiend and I don't (think) I see a UTF-8 file marker at the beginning, just the numbers:

44 69 72 65 63 74 6F

One other fact I can point out is: I am unable to save files on my computer when their file name begins with a "." so I have to upload the file with some made-up name (like 00000htaccess) and then rename it as .htaccess after the upload. I can't see how this would create the sort of problem I'm having, but I thought I'd mention it just in case.

Frank_Rizzo

4:38 pm on Aug 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If it's not the utf-8 marker then it could be the CR/LF translation.

Your editor is probably sending a CR/LF at the end of each line whilst the server needs unix format.

Check for a setting on your ftp client. Try a different ftp client. It would be better to use a secure one such as WinSCP or other type of sftp.

jdMorgan

6:10 pm on Aug 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It appears that the file starts with "Directory" or something similar, then:

44 69 72 65 63 74 6F
D i r e c t o

So it's not tagged as UTF-8, and the line-ender issue is the only other one that's likely. Although, it could be an 'endian' problem, and that again would be a editor compatibility issue.

Jim

hatchez11

6:27 pm on Aug 6, 2008 (gmt 0)

10+ Year Member



Thanks, Jim and Frank. I'll try the new ftp client within the next 24 hours and reply to this thread with my results.

Brian