简体   繁体   English

重定向http:// www。 https:// www的旧路径。 新路径(1to1重定向)

[英]Redirect http://www. old path to https://www. new path (1to1 redirect)

Struggle with Redirect http://www. 与重定向http://www. to new path and https://www. 到新路径和https://www. Since we want to force https:// it creates a chain from http://www. 由于我们要强制使用https://因此它会从http://www.创建一个链http://www. old path to https://www. https://www.旧路径https://www. old path to https://www. https://www.旧路径https://www. new path 新路

http://www. old path -> https://www. 旧路径-> https://www. old path -> https://www. 旧路径-> https://www. new path 301 -> 301 -> 200 新路径301-> 301-> 200

Anyone who can save my day? 谁能拯救我的一天? How do we solve this in .htaccess (apache)? 我们如何在.htaccess(apache)中解决此问题?

If you have a new domain name: 如果您有一个新域名:

<VirtualHost *:80>
  ServerName www.example-old.com
  Redirect 301 / https://www.example-new.com
</VirtualHost>

<VirtualHost *:443>
  ServerName www.example-new.com
  DocumentRoot /your_document_root
  SSLEngine on
  ...
</VirtualHost>

If you want to redirect from one folder to another: 如果要从一个文件夹重定向到另一个文件夹:

<VirtualHost *:80>
  ServerName www.example.com
  Redirect permanent / https://www.example.com
</VirtualHost>

<VirtualHost *:443>
  ServerName www.example.com
  Redirect 301 /old-path https://www.example.com/new-path
  DocumentRoot /your_document_root
  SSLEngine on
  ...
</VirtualHost>
<IfModule mod_rewrite.c>
RewriteEngine On 
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} wp-includes
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On 
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} old-page
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
</IfModule>

This setup works, but how do I add more URI's to do it in scale instead of adding 20-50 's? 此设置有效,但是如何添加更多URI来按比例进行而不是添加20-50?

How do URI for index/home page look? 索引/首页的URI外观如何? Since it's the root /. 由于它是根/。 What would be instead of wp-includes or old-page as folder there? 什么会代替wp-includes或old-page作为文件夹?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Mod_rewrite将默认路径与www结合在一起。 和https重定向 - Mod_rewrite combine default path with www. and https redirect htaccess将http://(www。)old.com和https://(www。)old.com重定向到https:// new - htaccess redirecting http://(www.)old.com and https://(www.)old.com to https://new 重定向http:// www。 对于根域和子域,以及http://到https - Redirect http://www. and http:// to https for both root and subdomain 如何强制将子域重定向到“https://www.”? - How to force redirect a subdomain to 'https://www.'? .htaccess重定向到https和www。 如果启用 - .htaccess redirect to https and www. if enabled HTTP:// WWW。 到http://重定向根本不起作用 - http://www. to http:// redirect not working at all 将所有流量重定向到https:// www。 目前,我有两个版本http:// www和https:// www - Redirect all of the traffic to https://www. Currently I have two versions http://www and https://www 将所有非www,www,http://请求重定向到https:// www。 使用.htaccess文件 - Redirect all non-www, www, http:// requests to https://www. using .htaccess file 重定向到https:// www。 当没有子域而只有https:时 - Redirect to https://www. when there is no subdomain and just https: when there is 如何重定向https:// www。 到https://? - How can I redirect https://www. to https://?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM