nadeems
(Nadyshaikh)
March 14, 2016, 9:54am
1
Hi,
I am facing small redirection issue
after successful login getting blank page not redirecting to another controller action or same controller action
i tried to redirect using these options
Yii::$app->getResponse()->redirect(’/requirements’);
return $this->goHome();
return $this->redirect(array(’/site/dashboard’));
return $this->redirect(’/site/dashboard’,302);
Please help me asap i’ll be thankful for solutions
softark
(Softark)
March 14, 2016, 10:53am
2
Yii::$app->getResponse()->redirect(’/requirements’);
return $this->goHome();
return $this->redirect(array(’/site/dashboard’));
return $this->redirect(’/site/dashboard’,302);
Where and how did you call one of these lines?
Please show us the controller code where you are trying to redirect.
er.ravi
(Er Ravi62)
March 14, 2016, 11:36am
3
Try this:
return $this->redirect(array(‘site/dashboard’));
It will definitely work!
nadeems
(Nadyshaikh)
March 15, 2016, 12:48pm
4
Hello Softark,
i am just trying login and redirect after success but its not working so i tried simple 2 action to redirect on page load
then also its not working
please check these 2 actions
public function actionTest(){
//return \Yii::$app->response->redirect(Url::to(['show']));
return $this->redirect(array('site/show'));
// Yii::$app->getResponse()->redirect('/requirements');
//return $this->goHome();
//return $this->redirect(array('/site/dashboard'));
//return $this->redirect('/site/dashboard',302);
}
public function actionShow(){
//your action here
echo "asd asd sadssd"; exit;
}
this simple redirection also not working getting blank page here is my PHPinfo page
http://ztek.magnusideas.com/phpinfo.php
softark
(Softark)
March 15, 2016, 1:18pm
5
It’s so strange. I really don’t know what’s going on.
Did you check the server log?
nadeems
(Nadyshaikh)
March 16, 2016, 8:32am
6
Yes its really strange i tried this on main domain its working fine but if i am using any sub domain its not working
there no error in logs also i just understand above mention point
softark
(Softark)
March 16, 2016, 12:42pm
7
Sounds like a problem with the server configuration.
What if you put a simple "index.html" saying "Hello world!" in "sub.domain/site/show" directory?
nadeems
(Nadyshaikh)
March 18, 2016, 6:13am
8
If i put url manually in address bar its working fine but only issue on form submit like if i am adding any record so after successful insert i am redirecting to view page or listing page but its not redirecting and showing same action with blank page
if i am trying to login same issue showing blank page after form submit but if i manually call internal page url from addressbar its showing me as a logged in user but not redirecting after successful login or logout
jacmoe
(Jacob Moen)
March 18, 2016, 8:04am
9
Is there a setting in your htaccess, if you are using that, which specifies the base path?
nadeems
(Nadyshaikh)
March 23, 2016, 7:59am
10
this is my .htaccess code
RewriteEngine on
# If a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward it to index.php
RewriteRule . index.php
sebako86
(Sebako86)
March 28, 2016, 1:58pm
11
I think the URL Helper in \yii\helpers\Url could do the Job for you.
Url::to(array("Controller/Action"));
This would take Care of Subdomains too.