News:

Join the Facebook Fan Page.

Main Menu

WAP2 Redirect

Started by Stanyy, June 13, 2013, 03:38:41 AM

Previous topic - Next topic

Stanyy

How do I redirect ALL my users to the wap2 version?

Kindred

why would you ever want to do that?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Stanyy

Because I want to. I need everyone to be on the mobile version. Can anyone be of assistance please?

krittin98

r u talking about opera mini, uc browser and smartphone browsers or even the computer users ?

The Team K Developers
www.theteamk.co.nr

MrPhil

If you expect ALL your users to be on mobiles, and able to use the WAP2 version, you should be able to redirect them in .htaccess. You would check for ;wap2 or whatever in the URI, and if it's not there, add it on to the URI. Would you need to take measures that you (the Admin) can still access from a PC without being forced to WAP2? If you are coming in from a specific IP address, that might be checked for. Otherwise, you could add a dummy flag to the URI, something like ;admin that would merely keep the ;wap2 from being added.

If you're on a Windows server, there ought to be some way to do this, similar to .htaccess.

By the way, isn't WAP2 very limited in capabilities? Text only, or something like that? Is that what you want to force on all your members, even those with tablets or smartphones?

Kindred

it is extremely limited.
WAP2 was deisgned for the old text-only mobile devices...
I don't even think you can get to the admin tools in WAP2 mode...

If you are trying to get a mobile design, you would be much better served to get one of the mobile-friendly themes....
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Stanyy

Mr Phil is a god. You always understand everything.

Actually I have a very nice redesigned wap2 website (hi Kindered) and i have packed it with pretty much most of the features of the full version. Plus its width is very fluid and looks great on all devices and PCs.

I also would like to still be able to access the full site as the admin if i want. Could you elaborate more on that? How does the ";admin" flag work? Do u mean I can use something like ";wap2;admin"

Also, when i'm on my phone and viewing wap2 version, there's a link below which says "Go to full version", that link has a "?nowap" at the end. Would this link still work after adding the ";wap2" to the .htaccess file?

Kindred

probably not...  and no, I do not believe that the admin flag words in combination with wap

So -- in other words, you have redesigned WAP mod (which is a standard, BTW) to be non-wap, but are still calling it WAP...

Why not just redesign your main theme in the first place? That way you don't have to worry about hacks and tweaks which won't work as you expect them to
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Stanyy

@Kindred. I have thought of that. What would you suggest I do apart from separately re-constructing the full version?

Considering they are both in php, Can I copy the code from my mobile template and paste it into index.template.php?

EDIT: No wait, if I do that I may not be able to access the full site anymore.

Kindred

correct... you don't just copy code....

the WAP version is specifically and severly limited.
IIRC, there are limits in the ACTUAL code (e.g. the Sources files), not just in the template files.

If you want a fully functional forum on monbile devices, you would need to do exactly what I said - create a full theme by redoing many, if not all the template files. I know two people have done just that.... 
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

MrPhil

Why don't you step back and state what you're trying to accomplish -- what members are on what devices, etc.? What is already built in to SMF that you could use? If WAP2 is very limited, do you really want to force it on all your members, even if they have a smartphone or tablet?

What are you trying to do? Where do you want to end up?

Stanyy

Yes Mr Phil, I want to force Wap2 on ALL my members, no matter what they are viewing the site with.

Kindred

Quote from: Kindred on June 14, 2013, 03:52:52 PM
the WAP version is specifically and severely limited.
IIRC, there are limits in the ACTUAL code (e.g. the Sources files), not just in the template files.

If you want a fully functional forum on mobile devices, you would need to do exactly what I said - create a full theme by redoing many, if not all the template files. I know two people have done just that....
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

MrPhil

#13
Quote from: Stanyy on June 14, 2013, 06:18:37 PM
Yes Mr Phil, I want to force Wap2 on ALL my members, no matter what they are viewing the site with.

OK, give this a try (assumes you're on an Apache server). In /.htaccess,
RewriteEngineOn
# there is already a Query String, but no ;wap2 and no ;admin -- add ;wap2
RewriteCond  %{QUERY_STRING}  .
RewriteCond  %{QUERY_STRING}  !;wap2  [NC]
RewriteCond  %{QUERY_STRING}  !;admin  [NC]
RewriteRule ^(.*)$  /$1;wap2  [L,QSA]
# there is not already a Query String -- add ?wap2
RewriteCond  %{QUERY_STRING}  !.
RewriteRule ^(.*)$  /$1?wap2  [L]


I can't try this out right now, so it may require some tweaking.

Stanyy

@Kindred, Thanks I'll definitely give that a shot later when I'm less busy.

@Mr Phil, I tried your code, It gives a 404. Can you try it out and correct any errors please?

I also would like to mention that I succeeded in the past to redirect operamini and blackberry users to wap2 by adding some code to index.php... It was something like... isset($_SERVER['HTTP_USER_AGENT'], 'Blackberry') Would I be able to do something like this globally?

Stanyy

I think I finally got it right. I just used a simple rewrite rule in .htaccess. Here's the code:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^/?$ "http\:\/\/domain\.com\/index.php\?wap2" [R=301,L]

Advertisement: