Redirect to default action in symfony - redirect

I'm using Symfony 1.4 to build a web application. The home page action for this application is as follows.
Module = content
Action = indexAction.php
/localhost/myapp/web/index.php/content/
I need to use this action as the defalut action when someone access the application folder using web browser. If someone access the myapp folder as follows.
/localhost/myapp
It should internally redirect to the
/localhost/myapp/web/index.php/content/
and access the homepage.
I guess Symfony routing will not work here. Can someone help me on this.

Using the symfony routing system, you can define the default module / action for the /.
In the myapp/config/routing.yml, define the homepage route (it's defined by default):
# default rules
homepage:
url: /
param: { module: content, action: index }
This way, accessing /myapp won't redirect you but you will be on your homepage.

Related

SharePoint Online: Redirect URIs for multi-site environment

We have a multi-site environment where each site has its own redirect URL. We want to use a single Client ID and Secret for our application but register multiple redirect URIs to it. Is it possible to add multiple URLs in below registration form:
I don't think there is possible solution to add on multiple URLs on the SharePoint online app registration form.
But from what i understand there is another way to achieve use a single Client ID and Secret for application and perform multiple redirects.
You can control the redirect url using the appredirect.aspx by specifying the redirect_uri parameter if you need to redirect from the default one check here for reference.
Basiclly it call the subsite page containing the below JS to install the app.
var url = String.format(
"{0}/_layouts/15/appredirect.aspx?client_id={1}&redirect_uri=https://***.azurewebsites.net/<<controller>>/<<view method containing the code to install the app>>?{{StandardTokens}}",
<<subsite url>>, "<<client id>>");
window.location.href = url;
The above javascript calls the appredirect.aspx page which then calls the app site as below,
https://****.azurewebsites.net/home?SPHostUrl=<<subsiteurl>>&SPLanguage=en-US&SPClientTag=1&SPProductNumber=**&SPAppWebUrl=<<weburl>>
Note: The above can be extended to check for the successful installation of the app and display an error message accordingly.
SPWeb.LoadAndInstallWeb equivalent REST / Javascript CSOM is also available here.
Here are some relevant links:
Use the redirect URL in an add-in that asks for permissions on the fly
Redirect URIs and a sample redirect page

Writing the uri pattern in the url

I'am using play framework 2.6 with scala, I want to prevent accessing my web pages from url .In the usual case if i write the URI pattern in the url it will redirct to the web page by executing the associated action ,for example if i write in the url : http://localhost:9000/home it will redirect to the home page, but what i want is to redirect to error page rather than the home page when writing an URI (in this case: /home) in the url.
my routes file
GET /home controllers.HomeController.index()
You can redirect in the controller method:
# my routes file
GET /home controllers.HomeController.errorRedirect()
# HomeController
...
def errorRedirect = Action {
Redirect("/error")
}
or perhaps you want to catch all and then redirect:
# my routes file
GET /home controllers.HomeController.home()
GET /*path controllers.HomeController.errorRedirect()
See also: supplying a custom error handler in the play docs.

Redirect Silex Boilerplate in Storyblok Project

How can I add redirects to my Storyblok project when it is using the Silex Boilerplate?
You can redirect to another page by returning a RedirectResponse response, which you can create by calling the redirect method:
app->get('/{{entry_path}}', function () use ($app) {
return $app->redirect('/{{exit_path}}');
});
http://silex.sensiolabs.org/doc/2.0/usage.html#redirects
When you want to delegate the rendering to another controller, without a round-trip to the browser (as for a redirect), use an internal sub-request (Don't use this if you really want to redirect your page). We provide such an forward in the app.php for the /home slug already, so /home page would be accessible on / without redirecting but doing a subrequest.

how to redirect/map to externalregistration page from AuthenticateExternalAsync to angular page

I am using external providers to login to my web app. (for example Google). In my custom userservice I get to AuthenticateExternalAsync and from there I want (if need to) redirect to Angular page.
public override Task AuthenticateExternalAsync(ExternalAuthenticationContext context)
{
...
...
context.AuthenticateResult = new AuthenticateResult("~/externalregistration", user.Subject, name, identityProvider: user.Provider);
return Task.FromResult(0);
}
i have html page
at https://localhost:44300/Content/app/externalregistration.html
How do I map externalregistration to this page?
At the moment I get an error
https://localhost:44300/identity/externalregistration#
HTTP Error 404.0 - Not Found
thank you
Mark
The page for the partial login has to be with IdentityServer - see that it's looking for it at /identity/ and not /Content/app/.
If from your user service you issue a partial login, then that web page is entirely up to you to serve up from the server. If that partial login page needs to know the identity of the user, then it needs to be hosted in the same path as IdentityServer so the partial login cookie can be read on the server. If you then want that page to be a SPA, then you'd have to have some server side code issue something into the browser for your SPA to know the identity of the user. If you want that page to be a SPA and make Ajax calls back to the server, you need to include some XSRF protection.
All in all, custom partial pages are easiest implemented as standard server-rendered MVC pages.

Zend REST controller with Backbonejs

Here is what iam planning to do :
I have a simple form and iam using BackboneJS.I want to make an AJAX request to check if username exisits or not.(Jquery ajax is much simpler,but iam told to do so).Iam using this article.So i created a controller called ArticleController :
namespace Album\Controller;
use Zend\Mvc\Controller\AbstractRestfulController;
class ArticleController extends AbstractRestfulController{
public function indexAction()
{
echo "Working";
}
}
In my module.config file i added to the array invokables :
'Album\Controller\Article' => 'Album\Controller\ArticleController',
(iam extending the zend skeleton application that they have build on the zend website).
So the problems iam facing :
when i goto
http:// zf2-tutorials/album
iam able to load the application (skeleton built on website), but if i do
http:// zf2-tutorials/article
it says page not found ! ? Should echo Working / What am i doing wrong/missing out
2.Is this the right approach what iam doing for making ajax request ?
Thank you