2011-09-04 83 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