It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center
                            
                        
                    
                
                                6年前关闭。
            
                    
我们需要在1和1 linux主机上创建一个非常简单的htaccess文件
这会将对“ localfile.html”的任何请求都重定向到“ localfile.php”
与htaccess文件位于同一目录中。
显示来自localfile.php的内容和URL(文件名)localfile.html
(仅能使1和1 htaccess用作对
域A到域B,不是我们需要的,而1和1显然没有
提供脚本支持。)

代码是:
我尝试过= RewriteRule上的RewriteEngine ^ localfile.html $ localfile.php [L] =并得到404

更新:
1and1 htaccess文件的功能有局限性

最佳答案

不知道我是否正确理解了这个问题。将URL路径localfile.html重写为localfile.php

RewriteEngine on
RewriteRule ^localfile.html$ localfile.php [L]


如果要重定向,请添加R标志

RewriteRule ^localfile.html$ localfile.php [R,L]

关于linux - 1and1和简单的htaccess重定向失败,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16178271/

10-10 16:31