Yii how to redirect to particular URL - yii

I have used url beautifier to remove index.php?r= from URL. it works fine.
now i want user to redirect to URL if user hits particular url.
suppose
http://localhost/xm/xmds.php?wsdl
To
http://localhost/xm_demo_menu/WebService/service
how to achieve this. i search lot on google but not found material relevant to my problem
any suggestions ?

I do not see where the problem should be. See documentation
In you controller, simply call:
$this->redirect("http://localhost/xm_demo_menu/WebService/service");

Related

Human-readable URL change

Question is the following, we have site with video. Where address is video title, which can changing all the time. For example user upload video and name it "nice video" then he rename it to "nice video in London". So in this case URL also changed from "http://example.com/video123/nice-video" to http://example.com/video123/nice-video-in-london.
From my research I found that dailymotion using canonical pointing to the page without any keywords in the URL (example.com/video123). So question which URL will be in SERP?
Question, how should we care of this? Thank you so much in advance for any suggestions on it.
Regards,
Constantine
Answer: You will put in the canonical link the link of the page that you intent to give the credit to. The page that is gonna show on SERP is the one its' link is INSIDE the canonical link tag and not the one that HAS the tag.
Why:
Page0 = http://example.com/video123/nice-video-in-london
Page1= http://example.com/video123/nice-video
The canonical link is used so u can make clear to the crawl bots the page is a "dublicated content" and the original is the "canonical link". So in your example the search engine is looking at the page 0 which is "http://example.com/video123/nice-video-in-london" and find a canonical tag. The search engine understands that this is a dublicated content and looks at the link in the canonical tag (canonical=---->original page1"http://example.com/video123/nice-video"<----) and realises that every traffic u are getting from page 1 should be added to the traffic of page 0. And for that reason the page 1 --->video123/nice-video-in-london.<--- is getting zero traffic while the page 0 --->video123/nice-video<--- is getting traffic accounted for both pages AND this page will show on SERP for obvious i think reasons.
Let me know if u have more questions on that or if you need some more details on how or why it works that way.

Redirect .htaccess to different page on different domain

I tried searching for similar posts but none of them satisfied my need. Hence I have to ask a new question
I have some domain space on my university website like this <university>.edu/~<myname> which is actually <university>.edu/~<myname>/index.html
I want all the traffic from here to go to <myname>.wix.com/resume. But I don't want other pages like my <university>.edu/~<myname>/somethingelse to redirect anywhere.
Also I want the address bar to still show <university>.edu/~<myname> even when it has readirected to my site on wix.com.
Kindly let me know if this is possible.
Thanks in advance.
No browser that I know of will allow itself to be redirected to a different site, without displaying the URL of the new site in the address bar. However, there are ways that you can display content from <myname>.wix.com/resume on your page at <university>.edu/~<myname>/index.html. One way is to use a frame (or an iframe) on <myname>.wix.com/resume which would load content from <university>.edu/~<myname>/index.html. Another (perhaps more seamless) solution would be to use a server-side scripting language (such as PHP) to create a script at <university>.edu/~<myname>/index.php which would download the content 'on the fly' from <myname>.wix.com/resume and display it at <university>.edu/~<myname>/index.php.

fixed url on address bar - show only base url http://www.mysite.com

I need to show on the address bar just the first part of the url of my site.
For example for any page with name like
http://www.mysite.com/mypage.php or
everything else
I want to see just http://www.mysite.com on the address bar of the browser.
How this can be achieved?
I tried with apache RewriteRule but with no result.
Apart from being a really bad idea for people actually trying to use your site, there is no way you can do this on the server side, because the server needs to know which page was accessed - that's what a URL is for. What you are looking for is to make it appear to the user that they are still at the same URL.
This is easy enough if you put your entire site in an HTML frameset with one frame, or an iframe sized to fill the browser window. This does require all external links to have target="_top", and without additional JS people can break out of the frame and access the pages individually anyway.
An alternative approach, that will only work on some browsers, would be to use history.pushState to fake the address bar back to / every time a new page loads.

Google share button, is it possible to share content from one URL and link back to another?

Example an online learning application that you want to share your results which are behind a logged in part of your site. So you add a public URL to your site for google to fetch the content (img, description, title):
data-href="http://www.example.com?result_id=24".
But then when someone views the post and sees the shared content and clicks the link to the site it goes to:
http://www.example.com?result_id=24
The only way I can think of is redirecting the user to http://www.example.com once they land on the shared URL.
Is there an official way or better way to do this?
Thanks
No, but there is a work around.
The URL that you share is used for both the snippet and place users are sent when they click.
However, you can put schema.org or OpenGraph markup on these pages that describes the content behind the login wall. This will allow you to specify a title, description and thumbnail. You can read more about configuring your snippet on Google Developers.

Yii-User and Yii-eauth integration

I am trying to put together an application using yii-user and yii-eauth extensions but I am coming up short. When I create a new webapp and install eauth I can get it to work fine so I know that I am not doing anything wrong on that end. I think the problem lies with my urls. This is a demo of what it is supposed to be like: http://nodge.ru/yii-eauth/demo/login. When someone clicks on say google it should bring you to the google sign in page but on my application I am getting a 404 error that states "The system is unable to find the requested action "login"." The url for this is user/user/login/service/google_oauth whereas the url should read user/login/service/google_oauth. Upon typing this into the browser manually I am redirected to the right page.
So I took a look into the EAuthWidget.php class to see if I could find out where it was getting that extra "user" from but I could not figure it out. I think it may have something to do with the fact that I have this in the user module which is in the /modules/user directory in my webapp. I also tried to use the URLManager to point to the right address but with no luck.
Does anyone have any similar experiences setting this up? Or any suggestions?
You just need to change the widget initialization code in your view(namely change the action property of the widget), somewhat like this:
<h2>Do you already have an account on one of these sites? Click the logo to log in with it here:</h2>
<?php
$this->widget('ext.eauth.EAuthWidget', array('action' => 'login'));
?>
Just to add, keep in mind that this action depends on which view you are including this widget, if the view is protected/views/site/login.php (which is yii's default site login view) then action should be able to go to the yii-user module's login action, so it'll be : 'action'=>'/user/login' , however if you are including this widget in yii-user's protected/modules/user/views/user/login.php then the action will be 'login' as already mentioned.