Php 如何在zend framework 1.10中使用htaccess屏蔽URL

Php 如何在zend framework 1.10中使用htaccess屏蔽URL,php,apache,.htaccess,zend-framework,mod-rewrite,Php,Apache,.htaccess,Zend Framework,Mod Rewrite,嗨,我必须创建类似于“to”的URL。我们已经尝试了使用codeignitor进行掩蔽,并且成功了。但是到了Zend,它抛出了错误“指定的控制器无效(印度)” 我们已经重写了htaccess规则,以屏蔽codeignitor中的URL。这里也应用了同样的方法,但在这里不起作用。我的密码是 #php_value magic_quotes_gpc off RewriteEngine on Options -Indexes Options FollowSymlinks RewriteEngine On

嗨,我必须创建类似于“to”的URL。我们已经尝试了使用codeignitor进行掩蔽,并且成功了。但是到了Zend,它抛出了错误“指定的控制器无效(印度)”

我们已经重写了htaccess规则,以屏蔽codeignitor中的URL。这里也应用了同样的方法,但在这里不起作用。我的密码是

#php_value magic_quotes_gpc off
RewriteEngine on
Options -Indexes
Options FollowSymlinks
RewriteEngine On
RewriteBase /

#Admin
RewriteRule ^admin(.*)$ public_mvc/admin.php [L]

#RewriteRule ^profile/(.*)/(.*)/(.*)(/|)$ user/profileview/index/$2 [L,NC]

RewriteRule ^profile/(.*)/(.*)/(.*)(/|)$ user/profileview/index/$2 [L,NC]

#RewriteRule ^profile/(.*)/(.*)/(.*)/?$ user/profileview/index/$2 [L,NC,QSA]

# Also Tried Ones. Start

#RewriteRule ^profile/(.*)/(.*)/(.*)/$ /user/profileview/index/$1 [NC,L]
#RewriteRule ^profile/(.*)/(.*)/(.*)/?$ /user/profileview/index/$2 [NC,L]
#RewriteRule ^profile/(.*)/(.*)/(.*) /user/profileview/index/$2 [NC]
#RewriteRule ^/profile/(.*)/(.*)/(.*)/?$ /user/profileview/index/$2 [QSA]

# Also Tried Ones. End

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ public_mvc/index.php

Rewriterule ^$ /home [r=301,nc]
这有什么问题?我们已经尝试了很多类型的选择。但一切都白费了。您可以在代码中看到所有这些不同的尝试。请帮我这个

提前谢谢。

以上url可以在htaccess中重写

方法1; 重写规则^profile/(*)$redirectedUrl.php[NC,L]

redirectedUrl.php作为页面,它应该放在根目录中,它不能显示错误,请在htaccess中更改url

方法2; 在bootstapper.php上处理重定向到某个控制器,并使用另一个操作


Zend\u Controller\u Router\u Route\u Regex感谢您的支持。我以其他方式实现了目标。我们已经根据需要更改了ZEND路由。所以我们有Auth文件(在每个请求中都会调用它)。在所有请求中都会调用此文件。因此,我所做的是检查URL,如果URL包含模块名为“Profile”,那么我使用“setModuleName”、“setControllerName”、“setActionName”等设置了模块、控制器和操作名


因此,它将做的是,如果URL中包含“Profile”,它将显式地设置模块、控制器和操作。我对.htaccess做了很多更改,但最终所有这些努力都白费了

您是否尝试使用zend路由器而不是htaccess?如果你使用zend router,默认情况下它会给出你想要的结果。就像你在方法一中所说的,如果我在根目录中使用redirectUrl.php并指向htaccess中的页面,那么页面将重定向到URL。我希望将我的页面重定向到该页面,但浏览器中的URL应类似于“”。
$ModuleName = $request->getModuleName();
$ControllderName = $request->getControllerName();
$ActionName = $request->getActionName();

/*
  This condition is added to mask the URL. This is added by Ghanta Kiran on 27-Dec-2013. Start
  Example : (From) http://www.contractskills.com/profile/india/username/id  ==> (To) http://www.contractskills.com/user/profileview/index/id
*/
if($ModuleName == 'profile')
{
 $paramId = $request->getParam('id'); // This is to get the User Id from the URL, to fetch the user profile details.
 $request->setModuleName('user');
 $request->setControllerName('profileview');
 $request->setActionName('index');
 $request->setParam('id',$paramId);         
}