---
title: "isRelativeUrl"
description: "Check whether a URL is a relative path rather than an absolute or protocol-relative URL, useful before joining it to a base."
canonical_url: "https://core.mhaibaraai.cn/en/docs/utilities/url/is-relative-url"
---
# isRelativeUrl

> Check whether a URL is a relative path rather than an absolute or protocol-relative URL, useful before joining it to a base.

## Usage

`isRelativeUrl` checks whether a URL is a relative path.

```ts
import { isRelativeUrl } from '@movk/core'

isRelativeUrl('/path/to/page') // true
isRelativeUrl('./page') // true
isRelativeUrl('../page') // true
isRelativeUrl('https://example.com') // false
```

## API

### `isRelativeUrl(url)`

Check whether a URL is a relative path.

### Parameters

**url** (`string`) *required*: The URL to check.

### Returns

**returns** (`boolean`): Whether the URL is a relative path.

## Changelog

See commit history for [src/utilities/url/parse.ts](https://github.com/mhaibaraai/movk-core/commits/main/src/utilities/url/parse.ts).

---

- [GitHub](https://github.com/mhaibaraai/movk-core/blob/main/src/utilities/url/parse.ts)


## Sitemap

See the full [sitemap](https://core.mhaibaraai.cn/sitemap.md) for all pages.
