<p>I solved like this, maybe any of you will use with different types of it.</p>

<pre><code>craft()-&gt;on('entries.onBeforeSaveEntry', function(Event $event) {
  $entry = $event-&gt;params['entry'];
  $turkishCharacters = ['ı', 'ü', 'ö', 'ş', 'ç', 'ğ'];
  $englishCharacters = ['i', 'u', 'o', 's', 'c', 'g'];

  $entrySlug = $entry-&gt;slug;
  $entrySlug = str_replace($turkishCharacters, $englishCharacters, $entrySlug);     
  $entry-&gt;slug = $entrySlug;
});
</code></pre>

CC BY-SA 4.0
2019-05-24T14:55:53.200Z
2019-05-24T14:55:53.200Z
Berk Can Demir
<p>I need to replace some characters in my entry's URI because we have some letters which do not exist in English like "ş" or "ç". It is a problem for SEO and we have to change each time manually. I tried something with <code>entries.onBeforeSaveEntry</code> but I couldn't solve the problem. I'm confused with getting URI and set the new URI. Any suggestion?</p>

CC BY-SA 4.0
2019-05-23T10:58:13.860Z
I think you may have to use the "After save entry" event to change a URI.
JMKelley
<plugin-development><craft2>
Changing some letters in entry's uri before save it
# Changing some letters in entry's uri before save it

(Asked by: username_0 on 2019-05-22)

I need to replace some characters in my entry's URI because we have some letters which do not exist in English like "ş" or "ç". It is a problem for SEO and we have to change each time manually. I tried something with `entries.onBeforeSaveEntry` but I couldn't solve the problem. I'm confused with getting URI and set the new URI. Any suggestion?

**Tags:** plugin-development, craft2
> **Comments:**
> **username_1**: I think you may have to use the "After save entry" event to change a URI.  

---

## 1 answers

### Answer by username_0 on 2019-05-24. Score: 1

I solved like this, maybe any of you will use with different types of it.
craft()->on('entries.onBeforeSaveEntry', function(Event $event) {
  $entry = $event->params['entry'];
  $turkishCharacters = ['ı', 'ü', 'ö', 'ş', 'ç', 'ğ'];
  $englishCharacters = ['i', 'u', 'o', 's', 'c', 'g'];

  $entrySlug = $entry->slug;
  $entrySlug = str_replace($turkishCharacters, $englishCharacters, $entrySlug);     
  $entry->slug = $entrySlug;
});


---

