![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: May 2009
Posts: 456
|
Mobile Redirect PHP Help
Ok, I am taking advice from Nicky(I think) and redirecting my mobile traffic to m.mydomain.com before I send it off to wherever I want to.
The problem I am having for some reason is getting the m.mydomain.com to redirect. I want to use a php redirect from one location for all of my sites. So I am using: <?php @ini_set('expose_php', 'Off'); @include "http:location of the php file";?> in the index.php of the m.mydomain.com. I want to be able to change the url at the "location of the php file" one time and it changes it on every site I have. For some reason when I try it its not working. I am using this in the "location of the php file": <?php /* Redirect browser */ header("Location: final redirected URL"); /* Make sure that code below does not get executed when we redirect. */ exit; ?> Where am I going wrong? Thanks
__________________
Contact ICQ: 570768377
Sub 1:440 Blog Converting Sponsor |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Permanently Gone
Industry Role:
Join Date: Mar 2004
Posts: 10,019
|
You mean include('file'); not include 'file' right?
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Permanently Gone
Industry Role:
Join Date: Mar 2004
Posts: 10,019
|
Oh, and you are including the FILE PATH, not some http:// path, right?
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
there's no $$$ in porn
Industry Role:
Join Date: Jul 2005
Location: icq: 195./568.-230 (btw: not getting offline msgs)
Posts: 33,063
|
So you want whatever hits m.oneofyourdomains.com to redirect to the same url?
Forget the include mess and use 1 index.php and point all your m.allyourdomains.com to the directory index.php is in. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Join Date: May 2009
Posts: 456
|
Whenever anyone goes to the "m" mobile sub domain of any site I have I want to be able to reroute them to another url. But I want to be able to control all of the redirecting from one spot. Change one link and they all change.
__________________
Contact ICQ: 570768377
Sub 1:440 Blog Converting Sponsor |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Join Date: May 2009
Posts: 456
|
It was the path to the php file in a folder on one of my domains.
I wasn't but I can do that.
__________________
Contact ICQ: 570768377
Sub 1:440 Blog Converting Sponsor |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
|
Care to elaborate or quote what he said?
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
Join Date: May 2009
Posts: 456
|
I think it was him, he said something like take his word for it to route the mobile traffic from your site to a subdomain and then to the the destination.
He didn't go into any details. I took it to mean that google may penalize the site if your just rerouting traffic off your site as soon as they get there but if you route them through a sub domain your main site doesnt get penalized. But he didn't say that, I inferred it from what he recommended.
__________________
Contact ICQ: 570768377
Sub 1:440 Blog Converting Sponsor |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Confirmed User
Join Date: May 2009
Posts: 456
|
I just did a soft 302 redirect from the server to the spot I have the url I want to direct the surfer to.
Works fine. If there is a better way to do it I am all ears. Otherwise I will just do it this way.
__________________
Contact ICQ: 570768377
Sub 1:440 Blog Converting Sponsor |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Permanently Gone
Industry Role:
Join Date: Mar 2004
Posts: 10,019
|
Sorry, I went to bed when I didn't see a reply from you. Do the path to the file on your server, i.e.:
require_once('includes/file.php'); (replace your include line with that) |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 | |
Confirmed User
Join Date: May 2009
Posts: 456
|
Quote:
On a side note I have to say I feel a little stupid about this but I want to place: RewriteCond %{HTTP_USER_AGENT} (mobile|android|blackberry|brew|cldc|docomo|htc|j2 me|micromax|lg|midp|mot|motorola|netfront|nokia|ob igo|openweb|opera.mini|palm|psp|samsung|sanyo|sch| sonyericsson|symbian|symbos|teleca|up.browser|voda fone|wap|webos|windows.ce) [NC] RewriteRule ^(.*)$ http://m.myurl.com [R=302,L] RewriteCond %{HTTP_USER_AGENT} (GoogleTV) [NC] RewriteRule ^(.*)$ http:myurl.com [R=302,L] in the htaccess but when I do my site goes 500. Where exactly should I place this in my wordpress htaccess file?
__________________
Contact ICQ: 570768377
Sub 1:440 Blog Converting Sponsor |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
Permanently Gone
Industry Role:
Join Date: Mar 2004
Posts: 10,019
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 |
Confirmed User
Join Date: May 2009
Posts: 456
|
When I included the php file where the end url is in the "m.mysite.com" the broswer doesnt follow the new url. In other words the site never redirects. If I go right to the file in my browser I am redirected and everything is fine.
__________________
Contact ICQ: 570768377
Sub 1:440 Blog Converting Sponsor |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 |
Permanently Gone
Industry Role:
Join Date: Mar 2004
Posts: 10,019
|
There are ways to check why that's happening (whitespace, accidental headers, etc), but if you're content with the 302, that seems to be enough.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#15 | |
Confirmed User
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#16 |
Beer Money Baron
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
|
You can use this as the index.php for your m.domain.com, and there's really nothing wrong with using the include this way.
Instead of redirecting from the included file, just use it to populate the url you want to redirect to. INDEX.PHP for your mobile domains Code:
<?php $redirect = file_get_contents( 'http://somedomain.com/mobile.ini' ); header( 'Location: ' . trim( $redirect ) ); exit(); ?> MOBILE.INI or whatever you decide to call it. Code:
http://redirectmymobiletraffichere.com
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#17 |
Beer Money Baron
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
|
If you use dropbox, one interesting way of managing this could be to create/edit a file like mobile.ini (or other name) in your Dropbox Public folder. It'd look something like:
http://dl.dropbox.com/u/3782156/mobile.ini It'd be a file on your computer, but also mirrored to Amazon's Cloud. You still just make that 1 change to a file anytime you want, and all your mobile sites will read it and redirect to the new location. Could be an interesting strategy for managing your simple data like this for other uses. Maybe even add a simple cache layer, to cache the file in your TMPDIR with an expire time like 15 mins.
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#19 | |
Industry Role:
Join Date: Aug 2006
Location: Little Vienna
Posts: 32,235
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |