Home
Support Forums

URL Redirection problem

Hi all, I just started learning netlify and is following a YT tutorial, however in the section of redirecting I faced a difficult issue, read the netlify articles and tried but still no fruit. As of right now I am only using developer mode but set it to ‘–live’ so everyone can observe.

The test server: https://firstapppermit-f86897.netlify.live/

The Issue is described below:

I am trying to demonstrate redirection using the ‘_redirects’ file, which content is written below:

/home   /
/living /die
/cuties https://www.petsofnetlify.com 301!

The first two redirects (which redirects to internal server) works fine with no issue, however each time i tried to use a URL to redirect to external website (tried LinkedIn, Instagram, finally petsofnetify) it always returns back to ‘/’ (index.html). I am very confused on whats wrong with just a simple redirect, the YT tutorial i’m following has absolutely no issue doing this. Requesting support and advise, thankyou.

My netlify.toml file:

[build]
    base="dist/"
    publish="dist/"

My project directory setup:

Observations:
adding ‘/’ before https…etc makes it redirect to /https://www.petsofnetlify.com (i know it will just say page not found but thats not the point) which means the rule is recognized by netlify

Attempts tried:
Using ‘200’ which ends up making a proxy in the same address (i dont want this)
Turning on/off pretty URL
using/not suing ‘301’ at the end of the line

Hi @yoshisam1

Welcome to the Netlify community.

Are you testing this on your local machine? If so have a look here

yes I am testing it on my local machine, and reading the thread you gave me it seems that I have similar issues, that it redirects me back to ‘/’ instead of the URL…the thread doesn’t seem to be resolved though.

At this stage it isn’t resolved.

You could lock your deploys then push a new deploy as a preview so you can test things without them going live. Do so myself regularly.

i see, alright, i will try that. Thankyou!