Mobile redirect to specific url

I’ve used the mobile redirect action successfully on a few sites but I have a question.

We have a website that has a database-driven news room with URLs structured like this that pull up a specific article:
domain.com/press_room/view.php?id=123

Is there a way to have a mobile redirect that includes the rest of the url so, for example, opening that page in a smartphone would redirect to a dynamic URL like this?
mobile.domain.com/press_room/view.php?id=123

Thanks in advance for any ideas how to do this.


freewaytalk mailing list
email@hidden
Update your subscriptions at:

If you have (and you should) a mobile page for every URL in your desktop site, then you can probably do this with a single directive. You just need to ensure that you append the querystring to the new URL when you redirect. I don’t know if the Action can do this, but it would not be difficult to program.

location.href = 'your.mobile.host' + location.pathname + location.search;

That ought to be enough to get you the whole way there.

Walter

On Apr 10, 2018, at 5:42 PM, Richard Cacciato email@hidden wrote:

I’ve used the mobile redirect action successfully on a few sites but I have a question.

We have a website that has a database-driven news room with URLs structured like this that pull up a specific article:
domain.com/press_room/view.php?id=123

Is there a way to have a mobile redirect that includes the rest of the url so, for example, opening that page in a smartphone would redirect to a dynamic URL like this?
mobile.domain.com/press_room/view.php?id=123

Thanks in advance for any ideas how to do this.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Forgot the protocol bit:

location.href = location.protocol + ‘your.mobile.host’ + location.pathname + location.search;

Walter

On Apr 10, 2018, at 10:56 PM, Walter Lee Davis email@hidden wrote:

If you have (and you should) a mobile page for every URL in your desktop site, then you can probably do this with a single directive. You just need to ensure that you append the querystring to the new URL when you redirect. I don’t know if the Action can do this, but it would not be difficult to program.

location.href = ‘your.mobile.host’ + location.pathname + location.search;

That ought to be enough to get you the whole way there.

Walter

On Apr 10, 2018, at 5:42 PM, Richard Cacciato email@hidden wrote:

I’ve used the mobile redirect action successfully on a few sites but I have a question.

We have a website that has a database-driven news room with URLs structured like this that pull up a specific article:
domain.com/press_room/view.php?id=123

Is there a way to have a mobile redirect that includes the rest of the url so, for example, opening that page in a smartphone would redirect to a dynamic URL like this?
mobile.domain.com/press_room/view.php?id=123

Thanks in advance for any ideas how to do this.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Hi Walter, thanks for your reply. I need to ruminate on this and may have more questions.


freewaytalk mailing list
email@hidden
Update your subscriptions at:

For the last few years now I have just been adding a JS script in the of the webpages to do this, as I rather have a separate .mobi site rather than a responsive one:

It’s been working perfect for me and it certainly increases the SEO as I have seen lots of related search engine queries come back listing both the .com and the .mobi websites as search results!

On Apr 11, 2018, at 8:08 AM, Richard Cacciato email@hidden wrote:

Hi Walter, thanks for your reply. I need to ruminate on this and may have more questions.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk

Robert Mitton
Organic SEO Specialist
Custom Mobi Websites
email@hidden
303 South Broadway, B353
Denver, CO 80209
cell phone (720) 435-9205

***** Disclaimer *****
This communication may be monitored and collected without consent, in secret, by the NSA, in likely violation of the Constitution of the United States of America. If you find this policy by the NSA reprehensible, please contact your government representatives and let them know.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Hi Robert, yes I do the same (there’s a nifty Freeway action to do this). This works for redirecting the entire site. But what I want to do is something like this. On a smartphone, this url (123 varies according to the page):

domain.com/press_room/view.php?id=123

redirects to

domain.com/mobile/press_room/view.php?id=123

where domain.com/mobile is where the mobile site resides.

That’s what I’d like to do.


freewaytalk mailing list
email@hidden
Update your subscriptions at:

I use the JS script and for each webpage of the desktop site I make a .mobi webpage and direct each particular desktop webpage go to its mate on the .mobi rather than redirecting the entire site. Go if there is 25 desktop web pages, then there are 25 different scripts, one for each page. I think this truly helps with the SEO.

On Apr 25, 2018, at 8:44 PM, Richard Cacciato email@hidden wrote:

Hi Robert, yes I do the same (there’s a nifty Freeway action to do this). This works for redirecting the entire site. But what I want to do is something like this. On a smartphone, this url (123 varies according to the page):

domain.com/press_room/view.php?id=123

redirects to

domain.com/mobile/press_room/view.php?id=123

where domain.com/mobile is where the mobile site resides.

That’s what I’d like to do.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk

Robert Mitton
Organic SEO Specialist
Custom Mobi Websites
email@hidden
303 South Broadway, B353
Denver, CO 80209
cell phone (720) 435-9205

***** Disclaimer *****
This communication may be monitored and collected without consent, in secret, by the NSA, in likely violation of the Constitution of the United States of America. If you find this policy by the NSA reprehensible, please contact your government representatives and let them know.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Hi Robert can you give me an example of the js you use?


freewaytalk mailing list
email@hidden
Update your subscriptions at:

On Apr 29, 2018, at 7:28 PM, Richard Cacciato email@hidden wrote:

Hi Robert can you give me an example of the js you use?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk

Robert Mitton
Organic SEO Specialist
Custom Mobi Websites
email@hidden
303 South Broadway, B353
Denver, CO 80209
cell phone (720) 435-9205

***** Disclaimer *****
This communication may be monitored and collected without consent, in secret, by the NSA, in likely violation of the Constitution of the United States of America. If you find this policy by the NSA reprehensible, please contact your government representatives and let them know.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Thanks. Actually I meant the javascript itself not just the tags…


freewaytalk mailing list
email@hidden
Update your subscriptions at:

He did give you the script, but he wrapped it in comment tags, which rendered it invisible in the browser. Here’s the code:

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:

OK thanks so much, Walter.


freewaytalk mailing list
email@hidden
Update your subscriptions at:

Ps: I’ve been using this:

<script type="text/javascript">//<![CDATA[
(function(){
	var ua = navigator.userAgent.toLowerCase();
	if(/iphone|ipod|android|blackberry|mini|windows ce|palm|symbian/i.test(ua) && /mobile/i.test(ua) && !(/ipad/.test(ua)))
		window.location.replace("http://www.blue-iceberg.com/mobile/");
})();
//]]></script>

What I was looking for was a dynamic redirect to redirect each page to a corresponding mobile version with a specific URL based on the originating page, not just a generic redirect. Walter mentioned something like this above.


freewaytalk mailing list
email@hidden
Update your subscriptions at:

You’re most of the way there with this script. Just change the line in the middle to include the current pathname (and search, if you’re using querystring variables in your URLs), assuming you have 1:1 concordance between all pages in / and /mobile/.

window.location.replace('http://example.com/mobile' + window.location.pathname + window.location.search);

You can see what those latter two variables will return in any given page by opening the developer console in your browser while you’re on any page, and typing the window.location.[whatever] incantation into the text field at the bottom of the console window. When you press return, the console will show you the current value assigned to that variable. Because you are using variables instead of hard-coded string values, the same script will stand in for every page in the entire site (assuming there is a matching version of every page in both the regular and mobile locations).

Walter

On May 1, 2018, at 8:58 AM, Richard Cacciato email@hidden wrote:

Ps: I’ve been using this:

What I was looking for was a dynamic redirect to redirect each page to a corresponding mobile version with a specific URL based on the originating page, not just a generic redirect. Walter mentioned something like this above.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options