My Domain redirects automatically to another website

I’m new on InfinityFree and I created an account to develop a proof-of-concept. For this, I create a free domain (gmrodasinterfacionais.rf.gd). After finished my development, I decided to go ahead with this website and for this, I get a domain on iFastNet (gmrodasinternacionais.com) and added it to my InfinityFree account. For some reason, I don’t know (perhaps I did something wrong), when I do a GET HTTP request to gmrodasinternacionais.com, I get this response HTTP/1.1 301 Moved Permanently. If I do a GET HTTP Request on gmrodasinternacionais.rf.gd it works fine. I don’t understand the reason for this 301 Moved Permanently. Could you help me with this?

This is the response I get on GET HTTP Request to gmrodasinternacionais.com
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Wed, 13 May 2020 21:24:39 GMT
Content-Type: text/html; charset=iso-8859-1
Content-Length: 228
Connection: keep-alive
Location: http://yoursite.com/
Cache-Control: max-age=0
Expires: Wed, 13 May 2020 21:24:39 GMT

Hello there,

The “HTTP 301 Removed Permanently” is not an error, but is a rule in your site that will let your browser know that your site will be permanently redirected to another page, for example: mydomain.com will permanently redirect to mydomain.net.

Check your .htaccess file in the /htdocs folder and if you see a code like this:

RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301]

In that file, then simply delete that line of code.

Also if you can’t find such code then check your index.html file and remove this line of code:

<meta http-equiv="refresh" content="0; URL=http://yoursite.com" />

Hrm… I’m getting http 500 instead of a redirect, have you checked your .htaccess file?

You’re right. It was a copy/paste issue. The line I want in .htaccess file was RewriteRule ^(.*)$ public/$1 [L] in order to point root requests to the folder public where I have my index.php file. This line is in the .htaccess file on my other domain (gmrodasinternacionais.rf.gd) and it’s working. In the domain (gmrodasinternacionaiscom) is returns me a 500 error with “Oops, something broke when loading the page you requested! This is usually caused by things like bad .htaccess lines”. I didn’t mention it before but this is a Symfony project.

Yes, I checked my .htaccess file and now I’m having an http 500. Please see my reply to @UnknownLolz

Could you send me a copy of your .htaccess file?
Maybe I can check your .htaccess file for broken/misconfigured rules.
When .htaccess files are not configured correctly then it will generate a HTTP Error 500.

Also you may want to refer to this Knowledge Base article:

If I comment the RewriteRule ^(.*)$ public/$1 and the line before, I don’t have the 500 error but it lists me the files on /htdocs folder, wich is correct (once the RewriteRule is commented).

php_value display_errors On
php_flag magic_quotes 1
php_flag magic_quotes_gpc 1
php_value mbstring.http_input auto
php_value date.timezone Europe/Lisbon
# Set environment variables
SetEnv APP_ENV prod
SetEnv DATABASE_URL 'mysql://epiz_25*****:****@sql209.epizy.com:3306/epiz_25*****_****'
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

All I can really suggest is to remove this htaccess rule:

RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]

And your site should load just fine.

2 Likes

I’m not sure this module is enabled. Can you please try removing the SetEnv lines and see if that works?

Assuming you’re using Laravel, you can just have a .env file with the settings. Since you have the rewrite rules, the file is not web accessible.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.