Reputation: 11
guys I'm new with Symfony and I have the follow question to see if this is possible.
Righ now I have an app that runs on Symfony that is located in www.domain.com/app and I want to if a user visits the URL redirect to another website (since a lot of users tries to brute force the login dashboard) but if I put the Symfony app login URL that is www.domain.com/app/dashboard/login the login dashboard appears.
I have to try to do something with .htaccess but with not luck.
Thanks
Upvotes: 0
Views: 561
Reputation: 381
You have a lot of soulion this one :
public function indexAction()
{
return $this->redirect('http://symfony.com/doc');
}
don't forget to check the documentation:
http://symfony.com/doc/2.8/controller.html#redirecting
Upvotes: 0
Reputation: 2487
to redirect any request you can use return $this->redirect('http://stackoverflow.com');
Upvotes: 0
Reputation: 103
maybe something like
RewriteRule ^app$ "http://otherwebsite.example.com/$1" [R,L]
in your .htaccess ? The complete login URL will still work because this Rule only catches URLS ending with app
Actually your question is not so Symfony specific. It is more about Rewrite Rules. Also, why not just answer with an error 404 if somebody accesses /app, (here with optional trailing slash) ?
RewriteRule ^app(\/?)$ - [L,R=404]
Upvotes: 2