Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

301 Redirect #1075

Closed
yasirrafiq33 opened this issue Jun 14, 2016 · 2 comments
Closed

301 Redirect #1075

yasirrafiq33 opened this issue Jun 14, 2016 · 2 comments
Assignees
Labels

Comments

@yasirrafiq33
Copy link

Hi,
We're moving a wordpress site to pencilblue and need 301 redirects. In request handler I'm a bit confused where to put in this logic. Need a suggestion.

@brianhyder
Copy link
Member

Two options. You can use the logic as show in the sample plugin: https://github.com/pencilblue/pencilblue/blob/master/plugins/sample/controllers/random_text_view.js#L245

or you can build your own redirect via something like the code shown below. This code would exist in a controller for a specific route.

SomeController.prototype.someRouteHandler = function(cb) {

  //do redirect the manual way to Google
  var result = {
    headers: {
      location: 'http://google.com'
    },
    code: 301
  };
  cb(result);
};

@brianhyder brianhyder self-assigned this Jun 14, 2016
@yasirrafiq33
Copy link
Author

I used the doRedirect methode that provide in Requesr.handler is that fine
or not?
On Jun 14, 2016 6:46 PM, "Brian" notifications@github.com wrote:

Two options. You can use the logic as show in the sample plugin:
https://github.com/pencilblue/pencilblue/blob/master/plugins/sample/controllers/random_text_view.js#L245

or you can build your own redirect via something like the code shown
below. This code would exist in a controller for a specific route.

SomeController.prototype.someRouteHandler = function(cb) {

//do redirect the manual way to Google
var result = {
headers: {
location: 'http://google.com'
},
code: 301
};
cb(result);
};


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1075 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AKvvxWJSrPT3tlnS-c19d77vvMDZNB4Gks5qLrClgaJpZM4I1A0s
.

@wasifali wasifali mentioned this issue Feb 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants