Reputation: 4465
Currently I'm trying to redirect from root.com/robots.txt to beta.root.com/robots.txt.
This is not working currently, any idea why?:
{
"version": 2,
"alias": ["root.com"],
"routes": [
{
"src": "/(.*)",
"status": 301,
"headers": { "Location": "https://beta.root.com/$1" },
"dest": "/$1"
}
]
}
Upvotes: 0
Views: 764
Reputation: 24610
You should not use dest
if you don't plan on proxy/rewriting requests.
Since you want the client to redirect, all you need is the header.
{
"version": 2,
"routes": [
{
"src": "/robots.txt",
"status": 301,
"headers": { "Location": "https://beta.root.com/robots.txt" }
}
]
}
If you want to redirect everything, use a wildcard:
{
"version": 2,
"routes": [
{
"src": "(.*)",
"status": 301,
"headers": { "Location": "https://beta.root.com$1" }
}
]
}
You can now use redirects
which is a little easier.
{
"redirects": [
{ "source": "(.*)", "destination": "https://beta.root.com$1" }
]
}
Upvotes: 3