<p>You can always use the search function -&gt; <a href="https://craftcms.com/docs/4.x/searching.html" rel="nofollow noreferrer">https://craftcms.com/docs/4.x/searching.html</a> which works excellent, especially via GraphQl. If you need to query for full Urls I would probably strip it to the pathname using <code>URL</code> in your application before sending it to Craft for searching.<br />
I hope I understood your question correctly ...</p>

CC BY-SA 4.0
2023-09-11T14:29:25.483Z
2023-09-11T14:29:25.483Z
thomas
<p>I'm using Craft in headless mode. It's a multisite setup different languages. I know that's it's possible to query an element by it's uri. Is there a way to check if a full path or an absolute url matches an craft element inside an module or plugin controller action?</p>
<p>For example i would like to check i a path like this examples matches an element on any site and return the entry and site:</p>
<pre><code>/my-example-element
/de/my-example-element
</code></pre>
<p>Is there any helper or built in method where i can pass the path and retrieve the matching element?</p>

<plugin-development><modules><controller><request><headless>
Is there a way to determine an element by its path or full url instead of the uri?
# Is there a way to determine an element by its path or full url instead of the uri?

(Asked by: username_0 on 2023-09-06)

I'm using Craft in headless mode. It's a multisite setup different languages. I know that's it's possible to query an element by it's uri. Is there a way to check if a full path or an absolute url matches an craft element inside an module or plugin controller action?
For example i would like to check i a path like this examples matches an element on any site and return the entry and site:
/my-example-element
/de/my-example-element

Is there any helper or built in method where i can pass the path and retrieve the matching element?

**Tags:** plugin-development, modules, controller, request, headless

---

## 1 answers

### Answer by username_1 on 2023-09-11. Score: 1

You can always use the search function -> <https://craftcms.com/docs/4.x/searching.html> which works excellent, especially via GraphQl. If you need to query for full Urls I would probably strip it to the pathname using `URL` in your application before sending it to Craft for searching.  
I hope I understood your question correctly ...


---

