Solved

htaccess mobile redirect to subdomain

Posted on 2012-03-24
1
832 Views
Last Modified: 2012-03-24
I'm trying to redirect my website to m.website for mobile.

I get a "too many redirects" error with the following:

RewriteEngine On 

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

Open in new window

0
Comment
Question by:Kyle Hamilton
1 Comment
 
LVL 25

Accepted Solution

by:
Kyle Hamilton earned 0 total points
ID: 37761700
never mind I figured it out. there was an unnecessary slash in the rule:

the correct script:

RewriteEngine On 

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

Open in new window

0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Apache HTTP to HTTPS redirect please. 5 54
Webmin Bandwidth Monitoring not working 10 143
ports for sccm 2012 1 87
$_SERVER Variable question 31 24
As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question