2011-09-04 82 views
1

我正在使用社交引擎,我想将我的网址从www.example.com/signup更改为www.example.com/activate,对不起,我想保留这两个网址。请让我知道如何做到这一点在社交引擎中重写网址

回答

2

把这段代码放到你的public/index.php文件中。

$FrontController = Zend_Controller_Front::getInstance(); 
$Router = $FrontController->getRouter(); 
$Router->addRoute("activate", 
new Zend_Controller_Router_Route 
(
"/activate", 
array 
("controller" => "signup", 
"action" => "index" 
) 
)); 

here:activate是路由器的名称。/activate是你想要的地址作为地址,控制器和动作是自我描述的。

+0

我的公用文件夹中没有index.php文件 –

+0

然后将代码放在引导文件中。我认为这也会起作用。或者将代码放在调用引导程序的文件中。但是在调用bootstrap之前先进行编码。 – Sourabh

+2

你正在研究Zend框架吗?如果你使用zend框架,你的公用文件夹应该有一个index.php文件。 – Sourabh

1

你可以修改你的.htaccess创建重定向,请参阅this example

2

在应用程序/模块/用途/设置/清单找到这些行:

'user_signup' => array(
     'route' => '/signup/:action/*', 
     'defaults' => array(
     'module' => 'user', 
     'controller' => 'signup', 
     'action' => 'index' 
    ) 

变化/signup/:action//activate/:action