Solved

htaccess mobile redirect to subdomain

Posted on 2012-03-24
1
827 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
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 …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
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…

770 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