如何将整个路径重定向到HTTPS?

时间:2017-10-21 21:39:32

标签: .htaccess url-redirection

我已经搜索过,但尚未找到答案。

我有一个食谱网站,所有食谱都是这样的道路:

http://example.com/recipe/recipe-name

如何将整个路径重定向到HTTPS?

现在我只重定向到我的主页,工作正常。

    RewriteCond %{HTTP_HOST} ^example\.com [NC]
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://example.com/$1 [R,L]

    RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://example.com/$1 [R,L]

感谢。

1 个答案:

答案 0 :(得分:0)

library(caret)
data("mtcars")
maeSummary <- function (data,
                        lev = NULL,
                        model = NULL) {

  require(Metrics)
  out <- mae(data$obs, data$pred)  
  names(out) <- "MAE"
  out
}

mControl <- trainControl(summaryFunction = maeSummary)

set.seed(123)
lm_model <- train(mpg ~ wt,
                  data = mtcars, 
                  method = "lm",
                  metric = "MAE",
                  maximize = FALSE,
                  trControl = mControl)
> lm_model$metric
[1] "MAE"

以上代码适用于非https&amp; www redirect ==&gt;没有www的https