gpt4 book ai didi

apache - 需要重定向 301 .htaccess 文件中的 URL,但它添加了额外的 http//?

转载 作者:行者123 更新时间:2023-12-04 07:43:38 25 4
gpt4 key购买 nike

我正在尝试将/abc.html 重定向到/abc.php 但是当我这样做时,它给出了 额外的 http//并且页面无法正常工作 http//www.example.de/abc.php 不知道这个 HTTP 是从哪里来的。
注意:网站没有ssl所以域名是http://example.de
我的 .htaccess 文件

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$ http://example.de/$1 [R=301,L]
RedirectPermanent /tour.html /tour.php

最佳答案

使用您显示的示例/尝试,请尝试以下操作。在测试您的 URL 之前,请确保清除浏览器缓存。

RewriteEngine ON
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [NE,R=301,L]

##To serve home page link.
RewriteRule ^/?$ index.php [L]

RewriteCond %{REQUEST_URI} !^/?$
RewriteRule ^([^.]*)\.html/?$ $1.php [NC,L]

关于apache - 需要重定向 301 .htaccess 文件中的 URL,但它添加了额外的 http//?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67316225/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com