[英]Redirect single HTTP URL to HTTPS via .htaccess
我创建了一个新网站。 旧的使用 http,新的使用 https,并且具有不同的 URL 路径。
例子:
OLD: website.com/index.php/powerpoint-presentation
NEW: https://website.com/powerpoint-presentation
如何以这种方式在 .htaccess 中定向单个 URL? 我想做大约 10 个手动 301 重定向。
在 .htaccess 文件中的旧网站上,您将使用以下内容:
Redirect 301 /index.php/powerpoint-presentation https://website.com/powerpoint-presentation
您当然可以根据需要使用尽可能多的。
可以像戴夫提到的那样完成单个重定向:
Redirect 301 /index.php/powerpoint-presentation https://website.com/powerpoint-presentation
但是,如果所有旧 URL 的结构都相同,而您只想删除 /index.php/,则可以这样做:
RewriteEngine On
RewriteRule ^index\.php/(.*)$ https://website.com/$1 [R=301,L]
这会将具有旧 /index.php/ 结构的任何 URL 重定向到 https:// 网站上没有 /index.php/ 的相同 URL
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.