我在將URL中的電子郵件地址傳遞給symfony應用程序時遇到了一些問題。Symfony:電子郵件地址作爲請求參數
的URL看起來像
example.com/unsubscribe/email/[email protected]
它總是導致sfError404Exception
,當週期被移除時除外。在做了一些Google搜索之後,我唯一看到的解決方案就是htaccess正在繞過網址,因爲這段時間是現在。然而,當我添加修復建議,以htaccess的,就像這樣:
# we skip all files with .something
RewriteCond %{REQUEST_URI} \..+$
RewriteCond %{REQUEST_URI} [email protected]+ #skip email address
RewriteCond %{REQUEST_URI} \.epl$
RewriteCond %{REQUEST_URI} !\.html$
RewriteCond %{REQUEST_URI} !\.rhtml$
RewriteRule .* - [L]
我會得到相同的404它也返回404當我在URL(example.com/index.php/unsubscribe/email/[email protected]
)直接使用前端控制器。我試圖將轉義版本直接放到地址欄中,例如example.com/unsubscribe/me%40example%2Ecom
,這個方法可行,但只適用於firefox,其他地方不適用。
我已經花了大約2個小時在這個論壇上回答了Google地址,並且我正在用盡想法。
有什麼想法?
謝謝。
更新:這裏是routing.yml中的相關章節:
unsubscribeform:
url: /unsubscribe/email/:email
param: { module: subscribe, action: index }
更新:堆棧跟蹤...看起來像它沒有得到任何路由信息去給我
404 | Not Found | sfError404Exception
Empty module and/or action after parsing the URL "/unsubscribe/email/[email protected]" (/).
stack trace
1. at()
in SF_SYMFONY_LIB_DIR/controller/sfFrontWebController.class.php line 44 ...
41.
42. if (empty($moduleName) || empty($actionName))
43. {
44. throw new sfError404Exception(sprintf('Empty module and/or action after parsing the URL "%s" (%s/%s).', $request->getPathInfo(), $moduleName, $actionName));
45. }
46.
47. // make the first request
2. at sfFrontWebController->dispatch()
in SF_SYMFONY_LIB_DIR/util/sfContext.class.php line 159 ...
156. */
157. public function dispatch()
158. {
159. $this->getController()->dispatch();
160. }
161.
162. /**
3. at sfContext->dispatch()
in /home/web/htdocs/index.php line 10 ...
7. require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'ProjectConfiguration.class.php');
8.
9. $configuration = ProjectConfiguration::getApplicationConfiguration(SF_APP, SF_ENVIRONMENT, SF_DEBUG);
10. sfContext::createInstance($configuration)->dispatch();
11.
+1,因爲我認爲我將運行到這個問題,以及 – 2009-10-19 20:32:18