Joan Nin Joan Nin - 4 months ago 29
PHP Question

Symfony Redirect

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

Oli Oli
Answer

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]