Reputation: 171
I need to assign https to my symfony 1.4 project. The only thing I have to change is htaccess or I'll have to write something in filters etc?
I'm asking because I tried to do this with htaccess but with no results.
Upvotes: 0
Views: 434
Reputation:
You can use filter to do it ,like this
class sfSecureFilter extends sfFilter
{
public function execute($filterChain)
{
$context = $this->getContext();
$request = $context->getRequest();
if (!$request->isSecure())
{
$secure_url = str_replace('http', 'https', $request->getUri());
return $context->getController()->redirect($secure_url);
}
else
{
$filterChain->execute();
}
}
}
Upvotes: 1