Permalink and secondery mobile site

3 posts by 1 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: May 11, 2015   (RSS)

By Twocans - May 1, 2015

Hello,

I have a site that uses permalink, all very nice etc

OK the site is   www.dingdong.com  <<<< alias name 

when customers come to the site rather then seeing, www.dingdong.com/aaaaabbb.php@a=1234345

They see  www.dingdong.com/hello.php  due to the wonderful powers of PermaLink of course.

When a customer comes to the site via mobile it gets detected and they get quickly redirected to

m.dingdong.com

The WWW site has about 500 pages and all use permalink (which is really brilliant)

Now I need to have a separate MOBILE site on the same server

aka when a punter comes to m.dingdong.com/hello.php I want permalink to do its job and show the same as it would do in the www site.

At present I can do my recordsets etc in dreamweaver etc and all works fine calling this infomation from my database.

My navigation on my mobile site point to  /hello.php 

can anyone point me in the right direction.

Am grateful, 

Regards

Kenny

By Twocans - May 5, 2015 - edited: May 6, 2015

OK I still have not worked out permalink but I have managed to get code below which works for me as I have tested it on 4 different phones and about 6 different computers lol.

See I was also worried how to redirect from a mobile site to the desktop version, as I did not want my site visitors to get to my mobile site via pc.

I still have not managed to get my permalink working on the mobile site anyway

the htaccess code is below and it works for me on hostgator 2015.

K

Redirect desktop users away from mobile site with .htaccess

#######################################################################################
# This .htaccess redirect desktop users away FROM mobile site with .htaccess 2015
# Don't forget replace instances of [example.com] in code below with your domain name.
# START
#######################################################################################

RewriteEngine On

RewriteCond %{HTTP_HOST} ^m\. [NC]
RewriteCond %{HTTP_USER_AGENT} !(android|blackberry|googlebot-mobile|iemobile|iphone|ipod|opera\smobile|palmos|webos) [NC]
RewriteRule ^ http://example.com%{REQUEST_URI} [L,R=302]

#######################################################################################
# The above .htaccess redirect desktop users away FROM mobile site with .htaccess
# FINISH
#######################################################################################

Above is for redirecting desktop users to mobile

Below is for redirecting desktop users to mobile


#######################################################################################
# This .htaccess file redirects mobile browsers and devices to an alternate destination
# Don't forget replace instances of [example.com] in code below with your domain name.
# START
#######################################################################################

# Ensure rewriting is on
RewriteEngine On

# Check for redirect param
RewriteCond %{QUERY_STRING} ^.*redirect=true.*
RewriteRule ^(.*)$ - [co=gomobi_prevent_redirect:false:.[example.com]:0:/]

RewriteCond %{QUERY_STRING} ^.*redirect=false.*
RewriteRule ^(.*)$ - [co=gomobi_prevent_redirect:true:.[example.com]:7200:/]


RewriteCond %{HTTP_COOKIE} !gomobi_prevent_redirect=true [OR]
RewriteCond %{QUERY_STRING} ^.*redirect=true.*

# Don't redirect if its false
RewriteCond %{QUERY_STRING} !^.*redirect=false.*

# Prevent loops
# RewriteCond %{HTTP_HOST} !^m.[example.com]$

# Exclude certain paths e.g. cpanel admin etc.
RewriteCond %{REQUEST_URI} !(.*)cpanel(/?)$
RewriteCond %{REQUEST_URI} !^/wp-(.*)$
RewriteCond %{REQUEST_URI} !/xmlrpc.php

# Exclude certain extensions e.g. images, docs etc
RewriteCond %{REQUEST_URI} !(.*).(?i:jpg|jpeg|webp|gif|bmp|png|js|css|txt|pdf|doc|docx|xls|xlsx|rar|zip|7z|mpg|mp4|mpeg|divx|avi|ogv|webm|mp3|ogg|wav|aac)

# Switch based on significant accept headers
RewriteCond %{HTTP_ACCEPT} "text/vnd.wap.wml|application/vnd.wap.xhtml+xml" [NC,OR]


# Specific devices/mandufacturers
RewriteCond %{HTTP_USER_AGENT} "iphone|ipad|ipod|android|nokia|ios|opera m(ob|in)i|iemobile|symbian|samsung|sec-|htc|huawei|ericsson|sonyericsson|blackberry|motorola|sagem|kyocera|zte|kddi|docomo|j-phone|kwc|lenovo|lg|mot|softbank|nec|audiovox|alcatel|sharp|sie-|sanyo|sendo|amoi|xda|bird|benq|palm|pantech|panasonic|fly|asus-|baiduispider|googlebot-mobile|nintendo|psp|dalvik|windows ce|foma|brew|webos|fennec|netfront|teleca|obigo|vodafone|up.browser|portalmmm" [NC]

RewriteRule ^(.*)$ http://m.[example.com] [L,R=302]
#### END GoMobi Redirect Settings ####

#######################################################################################
# This .htaccess file redirects mobile browsers and devices to an alternate destination
# FINISH
#######################################################################################