我在symfony 1.4中有一個關於路由和環境或模塊的嚴重問題,所以我創建了三個模塊前端,移動和後端。symfony 1.4中的路由和模塊
所以在前端和移動模塊,我使用幾乎相同的路由:
//apps/frontend/config/routing.yml
home:
url: /home
param: { module: user, action: home }
homepage:
url: /
param: { module: content, action: index }
....
default_index:
url: /:module
param: { action: index }
default:
url: /:module/:action/*
移動模塊:
//apps/mobile/config/routing.yml
home:
url: /home
param: { module: user, action: home }
homepage:
url: /
param: { module: sfGuardAuth, action: signin }
....
default_index:
url: /:module
param: { action: index }
default:
url: /:module/:action/*
我使用鏈接來訪問我的網站
mysite.com/ ==> frontend module(frontend.php)
mysite.com/mobile.php ==> mobile module(mobile.php)
問題是,當我訪問手機版登錄頁面正確,但登錄後,他們重定向到h前端模塊的頁面不到移動模塊的主頁?
備註:
當我使用這個鏈接mysite.com/mobile_dev.php
與開發ENV移動版本的作品非常好!
編輯:
這裏是我的htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} ^(%2d|-)[^=]+$ [NC]
RewriteRule ^(.*) $1? [L]
</IfModule>
Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
# uncomment the following line, if you are having trouble
# getting no_script_name to work
RewriteBase/
# we skip all files with .something
#RewriteCond %{REQUEST_URI} \..+$
#RewriteCond %{REQUEST_URI} !\.html$
#RewriteRule .* - [L]
# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
所以,當我改變index.php
到mobile.php
鏈接mysite.com/mobile.php
直接進入到移動版網頁和一切工作正常...
所以我現在的問題是如何編輯我的.htaccess重定向我這樣:
mysite.com/index.php or mysite.com/ redirect me to my site
mysite.com/mobile.php redirect me to mobile version
EDIT2:
我解釋你,當我開始使用這個鏈接mysite.com/mobile.php
所以它重定向我到移動應用,登錄頁面,但在登錄後,而不是它進入我的主頁了新的要求搜索默認的前端控制器,它點在index.php,讓我前端應用程序的主頁,而不是移動應用程序!
那麼爲什麼symfony與mobile_dev.php
一直保持在記憶中,我們在移動開發環境中一直保持着這種狀態,mobile.php
它在第一次重定向時將我從prod mobile env切換到前端prod env?
你應該檢查所有'settings.yml'中是否只有一個['no_script_name:true'](http://symfony.com/legacy/doc/reference/1_4/en/04-Settings#chapter_04_sub_no_script_name) 。 – 1ed 2013-04-25 16:42:04
是在前端和手機他們是no_script_name:在他們所有的settings.yml這兩個,這是什麼意思? – Nll 2013-04-25 16:50:50
這意味着配置不正確......您應該閱讀鏈接的文檔。 – 1ed 2013-04-26 07:24:34