0

I understand that my question is vague, which is probably the reason I can not find anything online.

This is what I am attempting to do. I want to have a URL like so:

http://app.myurl.com/8hhse92

8hhse92 is not a folder or file on my server. It is the ID or instance ID for a user. I want javascript/angular to be able to pull that info and use it to pass commands to the back end.

My question is then how do I tell my program/website to not try and go to that page but instead leave it there and go to a page that I tell my system to go to.

Austin Lovell
  • 1,049
  • 3
  • 17
  • 29
  • The phrase you are looking for is "URL Rewrite". See this: http://stackoverflow.com/questions/16388959/url-rewriting-with-php – NotMe Nov 18 '13 at 02:09

2 Answers2

0

I asked a similar question before and modified the .htaccess file to do that.

Change page content according to what URL is used to access your domain

Community
  • 1
  • 1
GSimon
  • 347
  • 1
  • 3
  • 14
0

If you are using angular-js, don't bother about the url. Angular js provides url structure like this. You can give a specific url to point into a specific file. Have a look on the following code.

var app = angular.module('EmsApp', ['ngRoute','ngResource','EmsAppFilter']);
app.config(['$routeProvider', function($routeProvider) {
    $routeProvider    
        /*login page*/
        .when('/login', {
            controller: 'loginController',
            templateUrl: 'path/to/login.html'
        })    
        /*project details page*/
        .when('/project/:project_id', {
            controller: 'projectController',
            templateUrl: 'path/to/project_details.html'
        });
}]);

In the second URL a project_id is passing. You can take the value of the project_id in the controller. Use $routeParams for getting a value passed in the URL.

app.controller('projectController',function($scope, $routeParams){
    // Take a value from url with $routeParams
    var project_id = $routeParams.project_id;
    // Then pass this value to your sever code using ajax request.
});
Sajith
  • 2,842
  • 9
  • 37
  • 49