0

My ubuntu is redirecting http://localhost to an external website (in my case https://about.gitlab.com).

I've looked at the apache.conf and etc/hosts, but I cannot find any reference to the redirect from localhost to an external website.

/etc/hosts only mentions: 127.0.0.1 localhost

So I'm wondering how can I (re)define a redirect from localhost to an external website? Or where else except for the /etc/hosts file or the apache.conf file.

jlanssie
  • 11
  • 1
  • 4
  • To confirm... this is a 3xx external redirect you are seeing? What is the HTTP status? Have you checked your server config? Where does localhost resolve to on your filesystem? (_Aside:_ How can your localhost be redirecting and you not know how it's configured? Is this not your machine?) – MrWhite Jan 28 '20 at 16:22
  • It's on my laptop. :-) I never configured any apache files before. I just started trying to put up a website on my local machine for backend development. So the error was just there to begin with. Or after downloading some gitlab shit at some point, I guess. Idk what a 3xx external redirect is. – jlanssie Jan 28 '20 at 16:53
  • Looking at the tags it isn't clear whether you are running Apache or nginx. Take your time to read the comments in `/etc/apache2/apache2.conf` and get accustomed to the configuration layout. Then look for `RewriteRule`'s. – Piotr P. Karwasz Jan 28 '20 at 18:31
  • ... or `Redirect` or `RedirectMatch` directives. – MrWhite Jan 28 '20 at 18:32

1 Answers1

1

Okay, I figured it out. The problem was my browser was caching 301 - permanent redirects indefinitely (which is expected behaviour).

Clearing those caches solved it. My apache settings and configs where okay. At some point localhost had pointed to gitlab, but that redirect was deleted upon clearing the caches.

jlanssie
  • 11
  • 1
  • 4