使用.htaccess更改地址栏中的内容但相同的页面

时间:2013-07-03 08:18:06

标签: .htaccess

我想当有人输入site.com/page.php来重定向并显示来自site.com/page1.php的内容但在地址栏中留下并显示site.com/page.php。

我该怎么做? 我现在用它

RedirectMatch 301 ^/stranica\.php$ /page.php

但这也改变了地址栏中的页面。

是否可以使用.htaccess?

1 个答案:

答案 0 :(得分:2)

试试这个:

RewriteRule ^stranica\.php$ /page.php [L]

您需要LAST标志且没有重定向部分才能执行内部重定向。

相关问题