Auto-redirect

Asked

Viewed 38 times

0

I need something to keep listening to the url ie if the url:

http://localhost:15000/api/Returnpayment/return

for acessa I want to redirect to another url. The problem is that the url is generated dynamically like this

http://localhost:15000/api/ReturnPayment/retornoPayPal?id=" + params.orderNo

I wonder if there is any way to redirect to another url only from the default url, ie http://localhost:15000/api/ReturnPayment/retornoPayPal/ ignoring everything that comes after

I already have some redirect means, only they’re fixed

    .config(function ($stateProvider, $urlRouterProvider, $locationProvider, $httpProvider) {
    $urlRouterProvider.when('/', '');
    $urlRouterProvider.when('/api/ReturnPayment/retorno', '/');
    $urlRouterProvider.when('/api/ReturnPayment/retornoPayPal', '/');
    $urlRouterProvider.otherwise('/');

I cannot pass as parameter only a part of the url for this to work I have to pass the exact url

1 answer

1


Check if the parameters exist with GET.

PHP

<?php 
 if(!isset($_GET)) header('Location: suapagina.php');
?>

Javascript

var pageURL = window.location.href.split('&');

if(pageURL.length <= 1) window.location.href = "http://answall.com";
  • I am working with Javascript, how can I do this using Javascript ?

  • By localhost associated with php, but can yes already edit

  • I was using localhost for testing. it worked this way only I switched the split for a replace to work in my case, thank you very much.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.