2013-02-09 83 views
2

您好,我需要每次用户输入www.mydomain.com/page时,他们都被重定向到 www.mydomain.com/portal/index.php?option=com_content & id = 84但在顶部的URL必须保持www.mydomain.com/pagehtaccess重写语法掩盖的URL

我在我的htaccess中尝试了很多东西。只是能够重定向,但不掩盖的网址..

这是我的代码。

Redirect 301 /page http://www.mydomain.com/portal/index.php?option=com_content&id=84 

RewriteEngine on 
RewriteBase/
RewriteRule ^/portal/index.php?option=com_content&id=84$ /page 

回答

1

你的RewriteRule的想法是正确的,除了它是倒退的。最终用户的URL位于左侧,重新编写的URL位于右侧。应该完全删除Redirect 301,因为这将更改浏览器URL。

RewriteEngine On 
RewriteRule ^page$ portal/index.php?option=com_content&id=84 [L] 
+0

对不起,我错过了或添加/,谢谢! – Monclee 2013-02-09 02:05:51