我用来练习.htaccess文件的这个简单的.htaccess几乎总是起作用的:
RewriteEngine on
RewriteRule ^.*$ test.html
当我拥有文件flowers.html并使用时,就会被重定向到test.html,但是当我将flowers.html重命名为flowers.php时,会得到一个带有消息The requested URL /flowers was not found on this server的404页。有人知道是什么原因造成的吗?
编辑:当我创建一个名为flowers的空文件时,它会正确地重定向到test.html。这里发生什么事情?
我们有一个客户端的网站,目前在我们的开发服务器。我们在格式化.htaccess文件时遇到了一些问题。目前,htaccess文件只在https://www.上导致重定向到inside.php。我们的目标是使每个页面重定向到使用https://www.。我们目前正在使用header.php文件中包含在每个页面中的基本url设置。不确定是否有更好的方法来完成我们正在努力做的事情,但如果有任何帮助,我们将不胜感激。
下面是我们.htaccess文件的当前内容。
RewriteEngine on
#enables you to access PHP files with HTML extension
我正在使用example.php将大约100个hmtl页面重定向到单个PHP页面( .htaccess )。它运转得很好。
我已经在那个页面上分页了(example.php),但是我使用的是原始的HTML (example.html?page=2&limit=20)
so example.html、example1.html、example2.html、example3.html都重定向到example.php。地址栏仍在显示“rendering.when”URL,但由于.htaccess重定向,example.php is .htaccess是单击分页链接(example.html?