Within angular routing is there any way to redirect to an external directory on the same domain. I have a WordPress blog and angular app I want it to use same domain rather than a subdomain.
Example
http://example.com --> Angular App
http://example.com/blog --> Wordpress Blog
Please help me with your suggestions.
Under the Domain category, choose the Redirects menu. You'll see the Create a Redirect section. Here, you'll need to fill in which URL you want to Redirect and where you want it to Redirect To. Make sure your information is correct and choose the right connection protocol – HTTP or HTTPS.
Click the URL Redirects tab. In the upper right, click Add URL redirect. In the right panel, select the Standard or Flexible redirect type. A standard redirect is used to redirect one URL to another.
Redirects allow you to forward the visitors of a specific URL to another page of your website. In Site Tools, you can add redirects by going to Domain > Redirects. Choose the desired domain, fill in the URL you want to redirect to another and add the URL of the new page destination.
I understand why you wanna do this with Angular router. Navigating to an external url from an Angular application is something quite easy. Using window.location
or an anchor tag is straight forward, but it has a big disadvantage, it bypasses the Angular Router.
@Adrian proposed a nice and generic way of navigating to an external url using the Angular Router which is written inside Using the Angular Router to navigate to external links. I like his implementation which looks clean and correct. He prepared the final result in stackblitz too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With