Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • What does "better" mean? Commented Jun 13, 2014 at 23:03
  • @Jon mainly would one method be more efficient over the other but if there are any other considerations it would be good to get opinions on them Commented Jun 13, 2014 at 23:05
  • 1
    .htaccess will be more efficient since it is internally redirecting the user and responding with the redirected request. Doing it the php method means php needs to be run and respond with that header and browser has to make another request. And php could maybe fail. But then so could your server. IOW there's more moving parts doing it the php way. Having said that.. doing it the php way gives you more control over injecting new requirements Commented Jun 13, 2014 at 23:05
  • @CrayonViolent ok, I hadn't really thought about it in respect of the fact the request need not go as far as php if handled by apache. seems obvious when you put it that way Commented Jun 13, 2014 at 23:09
  • 1
    @CrayonViolent htaccess is not necessarily redirecting internally. That's the case if you do a rewrite, but you can do something similar in PHP as well, by just executing the code you would execute for the new url. But in this case, the redirecting to https has a particular use and a rewrite won't cover that. Commented Jun 13, 2014 at 23:09