# Redirect URL to another domain with same path

**URL:** <https://forum.ghost.org/t/redirect-url-to-another-domain-with-same-path/16040>\
**Category:** Developer help\
**Created:** [July 22, 2020, 8:39pm UTC](https://forum.ghost.org/t/redirect-url-to-another-domain-with-same-path/16040 "2020-07-22T20:39:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harpreet\_Singh](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/harpreet_singh/32/9025_2.png) [@Harpreet\_Singh](https://forum.ghost.org/u/Harpreet_Singh)\
**Post date:** [July 22, 2020, 8:39pm UTC](https://forum.ghost.org/t/redirect-url-to-another-domain-with-same-path/16040/1 "2020-07-22T20:39:08Z")

</div>

Hi, I try to use Redirect.json for redirect URLs.  
I use this in redirect.json file  
[{  
“from”: “/([a-zA-Z\d.-]+)”,  
“to”: “[https://blog.anotherdomain.com/$1](https://blog.anotherdomain.com/%241)”,  
“permanent”: true  
}]  
its redirect to another domain but in URL its printing $1 its unable to fetch URL path  
please help me to solve this

---

<div class="post-metadata">

**Author:** ![DavidDarnes](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/daviddarnes/32/3533_2.png) [@DavidDarnes](https://forum.ghost.org/u/DavidDarnes)\
**Post date:** [July 23, 2020, 11:35am UTC](https://forum.ghost.org/t/redirect-url-to-another-domain-with-same-path/16040/2 "2020-07-23T11:35:14Z")

</div>

Hey @Harpreet_Singh 👋  
Are you trying to redirect all the URLs? Maybe something like this would work:

```auto
[
  {
    "from": "^\/(?!content/images)(.*)",
    "to": "https://blog.anotherdomain.com/$1",
    "permanent": true
  }
]

```

---

<div class="post-metadata">

**Author:** ![Harpreet\_Singh](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/harpreet_singh/32/9025_2.png) [@Harpreet\_Singh](https://forum.ghost.org/u/Harpreet_Singh)\
**Post date:** [July 25, 2020, 4:03pm UTC](https://forum.ghost.org/t/redirect-url-to-another-domain-with-same-path/16040/3 "2020-07-25T16:03:50Z")

</div>

> [@DavidDarnes](#):
>
> ```auto
> "from": "^\/(?!content/images)(.*)",
> "to": "https://blog.anotherdomain.com/$1",
> 
> ```

Hi @DavidDarnes

Its redirecting to [https://blog.anotherdomain.com/$1](https://blog.anotherdomain.com/$1)  
in $1 there is no value and its redirect to 404

---

<div class="post-metadata">

**Author:** ![DavidDarnes](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/daviddarnes/32/3533_2.png) [@DavidDarnes](https://forum.ghost.org/u/DavidDarnes)\
**Post date:** [July 29, 2020, 11:09am UTC](https://forum.ghost.org/t/redirect-url-to-another-domain-with-same-path/16040/4 "2020-07-29T11:09:49Z")

</div>

This may be due to the version of Ghost you’re using. This should work in the latest version of Ghost (3.27.0)
