.htaccess 500 internal server error when adding simple 301 redirect

Michael Rogers

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.

TrtG

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] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Htaccess rewrite url gives 500 Internal server error

분류에서Dev

500 Internal Server Error when sending email notification

분류에서Dev

getting 500 internal server error?

분류에서Dev

a 500 Internal Server Error error was encountered

분류에서Dev

jQuery posting got 500 Internal Server Error?

분류에서Dev

.htaccess file causes internal server error

분류에서Dev

htaccess 301 redirect -- remove a string

분류에서Dev

htaccess 301 redirect — remove a path

분류에서Dev

Controller requires a value for one parameter - Internal server error 500

분류에서Dev

500 Internal Server Error, but works fine on localhost - $mysqli = new mysqli

분류에서Dev

Trying to use JSON but getting '500 Internal Server Error'

분류에서Dev

Redirect 301 in htaccess changes the url encoding

분류에서Dev

HTACCESS 301 redirect issue with strange url variables

분류에서Dev

htaccess redirect 301 https www to non www

분류에서Dev

500 Internal Server Error with bare git repo after post-receive hook

분류에서Dev

htaccess 301 Redirect Wildcard for New Base Domain Name

분류에서Dev

heroku: internal server error

분류에서Dev

Why do I get internal error 500 when sending empty POST request

분류에서Dev

I can't open phpMyAdmin, get error 301 or 500

분류에서Dev

301 .htacess redirect issue

분류에서Dev

Django는 utf-8 문자열을 $ .post 할 때 "500 INTERNAL SERVER ERROR"를 반환합니다.

분류에서Dev

Stripe Invalid CVC return 500 server error

분류에서Dev

Spring File Upload Internal server error

분류에서Dev

Internal server error in jquery ajax request

분류에서Dev

Multible RewriteRules result in Internal Server Error

분류에서Dev

GAE JSP INTERNAL_SERVER_ERROR

분류에서Dev

Getting 500 error when sending Ajax request

분류에서Dev

.htaccess & error pages - Stay on page and don't redirect

분류에서Dev

301 redirect for all get request

Related 관련 기사

  1. 1

    Htaccess rewrite url gives 500 Internal server error

  2. 2

    500 Internal Server Error when sending email notification

  3. 3

    getting 500 internal server error?

  4. 4

    a 500 Internal Server Error error was encountered

  5. 5

    jQuery posting got 500 Internal Server Error?

  6. 6

    .htaccess file causes internal server error

  7. 7

    htaccess 301 redirect -- remove a string

  8. 8

    htaccess 301 redirect — remove a path

  9. 9

    Controller requires a value for one parameter - Internal server error 500

  10. 10

    500 Internal Server Error, but works fine on localhost - $mysqli = new mysqli

  11. 11

    Trying to use JSON but getting '500 Internal Server Error'

  12. 12

    Redirect 301 in htaccess changes the url encoding

  13. 13

    HTACCESS 301 redirect issue with strange url variables

  14. 14

    htaccess redirect 301 https www to non www

  15. 15

    500 Internal Server Error with bare git repo after post-receive hook

  16. 16

    htaccess 301 Redirect Wildcard for New Base Domain Name

  17. 17

    heroku: internal server error

  18. 18

    Why do I get internal error 500 when sending empty POST request

  19. 19

    I can't open phpMyAdmin, get error 301 or 500

  20. 20

    301 .htacess redirect issue

  21. 21

    Django는 utf-8 문자열을 $ .post 할 때 "500 INTERNAL SERVER ERROR"를 반환합니다.

  22. 22

    Stripe Invalid CVC return 500 server error

  23. 23

    Spring File Upload Internal server error

  24. 24

    Internal server error in jquery ajax request

  25. 25

    Multible RewriteRules result in Internal Server Error

  26. 26

    GAE JSP INTERNAL_SERVER_ERROR

  27. 27

    Getting 500 error when sending Ajax request

  28. 28

    .htaccess & error pages - Stay on page and don't redirect

  29. 29

    301 redirect for all get request

뜨겁다태그

보관