# 摧毁所有永久链接

**URL:** https://meta.discourse.org/t/destroy-all-permalinks/65532
**Category:** Sysadmins
**Tags:** how-to
**Created:** [2017年七月3日 17:34 UTC](https://meta.discourse.org/t/destroy-all-permalinks/65532 "2017-07-03T17:34:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2017年七月3日 17:34 UTC](https://meta.discourse.org/t/destroy-all-permalinks/65532/1 "2017-07-03T17:34:57Z")

</div>

If you think that only search engines have links to your old URLs, the search engine databases have been updated, and you want to save as much as 20ms on every 404, you can do this:

```plaintext
cd /var/disourse/
./launcher enter app
rails c
Permalink.destroy_all
exit
exit

```

Thanks to @zogstrip for pointing out the obvious (once you know it)!

---

<div class="post-metadata">

### Author: ![elijah](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elijah/32/104055_2.png) [@elijah](https://meta.discourse.org/u/elijah)
#### Post date: [2017年七月3日 17:40 UTC](https://meta.discourse.org/t/destroy-all-permalinks/65532/2 "2017-07-03T17:40:07Z")

</div>

> [@pfaffman](#):
>
> you want to save as much as 20ms on every 404

Woohoo! That’s really selling it.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2017年七月3日 17:41 UTC](https://meta.discourse.org/t/destroy-all-permalinks/65532/3 "2017-07-03T17:41:51Z")

</div>

> [@pfaffman](#):
>
> It seems like there should be a way that they could all be destroyed without a loop, but it eludes me.

Have you tried `Permalink.destroy_all`? 😉

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2017年七月3日 17:48 UTC](https://meta.discourse.org/t/destroy-all-permalinks/65532/4 "2017-07-03T17:48:26Z")

</div>

No! (obviously). I tried permutations of `Permalink.destroy` and `Permalink.something.destroy`.

Public humiliation is a good way to remember things, though, so I think I’ve got this one down now. 🙂
