# Custom URL for a ionic page

**URL:** <https://forum.ionicframework.com/t/custom-url-for-a-ionic-page/135151>\
**Category:** ionic-v3\
**Created:** [July 12, 2018, 5:10pm UTC](https://forum.ionicframework.com/t/custom-url-for-a-ionic-page/135151 "2018-07-12T17:10:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajbasilio](https://avatars.discourse-cdn.com/v4/letter/r/6a8cbe/32.png) [@rajbasilio](https://forum.ionicframework.com/u/rajbasilio)\
**Post date:** [July 12, 2018, 5:10pm UTC](https://forum.ionicframework.com/t/custom-url-for-a-ionic-page/135151/1 "2018-07-12T17:10:31Z")

</div>

In the ionic page I have added

```
@IonicPage({
  name: 'login-page',
  segment: 'login'
})

```

When I am trying to open them using url

> [http://localhost:8100/#/login](http://localhost:8100/#/login)

I’m getting error as

> Uncaught (in promise): Error: Type LoginPage is part of the  
> declarations of 2 modules: AppModule and LoginPageModule! Please  
> consider moving LoginPage to a higher module that imports AppModule  
> and LoginPageModule. You can also create a new NgModule that exports  
> and includes LoginPage then import that NgModule in AppModule and  
> LoginPageModule. Error: Type LoginPage is part of the declarations of  
> 2 modules: AppModule and LoginPageModule! Please consider moving  
> LoginPage to a higher module that imports AppModule and  
> LoginPageModule. You can also create a new NgModule that exports and  
> includes LoginPage then import that NgModule in AppModule and  
> LoginPageModule.

& sometimes it’s opening the root page (Homepage/first page) but it does not navigate to `loginPage`. I have imported the page in the `app.module.ts`  
How can I solve it?

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [July 12, 2018, 7:38pm UTC](https://forum.ionicframework.com/t/custom-url-for-a-ionic-page/135151/2 "2018-07-12T19:38:11Z")

</div>

The presence of the `@IonicPage` declaration makes the page lazily loaded, which means that it needs to get out of the app module.

---

<div class="post-metadata">

**Author:** ![rajbasilio](https://avatars.discourse-cdn.com/v4/letter/r/6a8cbe/32.png) [@rajbasilio](https://forum.ionicframework.com/u/rajbasilio)\
**Post date:** [July 13, 2018, 6:19am UTC](https://forum.ionicframework.com/t/custom-url-for-a-ionic-page/135151/3 "2018-07-13T06:19:22Z")

</div>

should i remove the import from `app.module.ts`.

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:30pm UTC](https://forum.ionicframework.com/t/custom-url-for-a-ionic-page/135151/4 "2021-07-19T21:30:03Z")

</div>

Closed on July 19, 2021, 9:30pm UTC


