This is driving me crazy.
Long story short i can't change anything on my .htaccess because it generates a 500 Internal server error.
Some days ago i noticed something weird, some of the files on my server .htaccess included starting to show with line breaks between each line, or the whole code in 1 long line which caused thing breaking on the site.
Now whenever i try to add something simple to .htaccess like a 301 redirect: Redirect 301 /random-file.html http://dumbsite.com/section/random-file.html
It gives me a 500 Internal server error, i know this happens when you do things wrong but i'm 100% sure my rule is correct.
My theory is that it has something to do with notepad++ of filezilla. So the question is: On notepad++ what encoding or settings do i need to have or not have to avoid this.
And also if Filezilla is the cause, should i use Binary or ASCII or Auto transfer method and should i leave "Thread dotfiles as ASCII" ticked or not on transfer settings. I've tried every combination and no matter what it gives me the 500 Internal server error.
So maybe there's more than 1 thing wrong.
UPDATE! Ok, i've been debuging this. and i can confirm the error comes from Notepad++ I've reseted to defaults both filezilla and notepad++ and the error still happened. So i choose to edit the file with regular notepad added my 301 redirect and boom it worked! So filezilla is OK. My 301 is OK and working.
The problem relies on the format notepad++ is using to save the .htaccess file. So if anyone could tell me what settings you use to generate a functional .htaccess file with notepad++ i'm all set.
Have you tried to check the line breaks configuration from notepad? Because if you edit your code on windows with windows format line breaks and then just put it as is on a Linux server it won't work. You can convert them to unix format in notepad edition menu.
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加