I'm trying to have google crawling my site but the search console says the site returns an 500 error. Even though it works as expected in any browser. I've also noticed on facebook when I type the url in the chat the preview card shows "Ooops, something went wrong"
I ran it through httpstatus.io and it confirms it. The page throws an 500 error after https redirect.
Status Code,Scheme,Host,Path
301,http://,rfa.is,
500,https://,rfa.is,/
I have other sites set up the same with no problems.
This is the .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
# Force SSL
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Remove public folder form URL
RewriteCond %{THE_REQUEST} !/storage/ [NC]
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
The URL is https://rfa.is
Any Ideas?
I think that the issue is not with
.htaccess
. The redirection works fine in browser but if you try to access it using command-line tool likecurl
in linux terminal, thehttps
version gives500
error. HTTP to HTTPS redirectioncurl -IL http://rfa.is/
and direct HTTPScurl -IL https://rfa.is/
generatesHTTP/2 500
in HTTPS version. There may be some server side restriction to only serve to some specific types of browsers.
Quoted my comment.
Oh I think I found out the reason.
If you provideaccept-language
header in request, regardless of its value, the result is200 OK
.
curl -IL 'http://rfa.is/' -H 'accept-language: en-US,en;q=0.9'
,curl -IL 'http://rfa.is/' -H 'accept-language: ;'
andcurl 'https://rfa.is/' -H 'accept-language: ;'
works equally fine.
Same results with GuzzleHttp with PHP.
Conclusion: There seems to be some restriction / setting on server side that generates500 Internal Server Error
ifaccept-language
header is not present in request.
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
Welcome to the Q&A site for web developers. Here you can ask a question about the problem you are facing and get answers from other experts. We have created a user-friendly interface so that you can quickly and free of charge ask a question about a web programming problem. We also invite other experts to join our community and help other members who ask questions. In addition, you can use our search for questions with a solution.
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.