.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

unity 500 internal server error

分類Dev

.htaccess 301 redirect rule

分類Dev

htaccess 301 Redirect to Subdomain

分類Dev

Cronjob causing 500 internal server error

分類Dev

500 internal server error elastic beanstalk flask

分類Dev

Internal Server Error after changing htaccess

分類Dev

.htaccess file causes internal server error

分類Dev

500 Internal Server Error Apache2 When Opens pdf file

分類Dev

htaccess 301 redirect not working properly

分類Dev

.htaccess 301 redirect conflicting with rewriterule

分類Dev

ajax post in laravel 5 return error 500 (Internal Server Error)

分類Dev

ASP.NET Core hosting - 500 internal server error

分類Dev

how to show 500 internal Server error page in laravel 5.2?

分類Dev

Insert into AJAX Laravel return 500 Internal Server Error

分類Dev

How to intercept 500 internal server error in WSO2 ESB

分類Dev

Jcrop & Canvas: Size of cropped area is weird & 500 Internal Server Error

分類Dev

500 internal server error while saving data to mongoDB

分類Dev

htaccess 301 redirect only certain URL with exlusion

分類Dev

Htaccess 301 redirect with query string params

分類Dev

Redirect 301 Urls with id number htaccess

分類Dev

Redirect 301 in htaccess changes the url encoding

分類Dev

HTACCESS 301 redirect issue with strange url variables

分類Dev

301 htaccess redirect forwarding to incorrect address

分類Dev

Apache2 gives me an internal 500 error while trying to force HTTPS for the client using .htaccess files when using a self-signed certificate

分類Dev

MVC4: After server restart, cannot post ajax internal server error 500

分類Dev

Failed to load resource: the server responded with a status of 500 (Internal Server Error) Azure MVC

分類Dev

Gitlab webhook get error:500 Internal Server Error-URI :: InvalidURIError

分類Dev

Jquery ajax call to pass JSON array in MVC (500 internal server error)

分類Dev

500 internal server error mod_wsgi apache "importerror: No Module named 'django'

Related 関連記事

  1. 1

    unity 500 internal server error

  2. 2

    .htaccess 301 redirect rule

  3. 3

    htaccess 301 Redirect to Subdomain

  4. 4

    Cronjob causing 500 internal server error

  5. 5

    500 internal server error elastic beanstalk flask

  6. 6

    Internal Server Error after changing htaccess

  7. 7

    .htaccess file causes internal server error

  8. 8

    500 Internal Server Error Apache2 When Opens pdf file

  9. 9

    htaccess 301 redirect not working properly

  10. 10

    .htaccess 301 redirect conflicting with rewriterule

  11. 11

    ajax post in laravel 5 return error 500 (Internal Server Error)

  12. 12

    ASP.NET Core hosting - 500 internal server error

  13. 13

    how to show 500 internal Server error page in laravel 5.2?

  14. 14

    Insert into AJAX Laravel return 500 Internal Server Error

  15. 15

    How to intercept 500 internal server error in WSO2 ESB

  16. 16

    Jcrop & Canvas: Size of cropped area is weird & 500 Internal Server Error

  17. 17

    500 internal server error while saving data to mongoDB

  18. 18

    htaccess 301 redirect only certain URL with exlusion

  19. 19

    Htaccess 301 redirect with query string params

  20. 20

    Redirect 301 Urls with id number htaccess

  21. 21

    Redirect 301 in htaccess changes the url encoding

  22. 22

    HTACCESS 301 redirect issue with strange url variables

  23. 23

    301 htaccess redirect forwarding to incorrect address

  24. 24

    Apache2 gives me an internal 500 error while trying to force HTTPS for the client using .htaccess files when using a self-signed certificate

  25. 25

    MVC4: After server restart, cannot post ajax internal server error 500

  26. 26

    Failed to load resource: the server responded with a status of 500 (Internal Server Error) Azure MVC

  27. 27

    Gitlab webhook get error:500 Internal Server Error-URI :: InvalidURIError

  28. 28

    Jquery ajax call to pass JSON array in MVC (500 internal server error)

  29. 29

    500 internal server error mod_wsgi apache "importerror: No Module named 'django'

ホットタグ

アーカイブ