Solved

htaccess mobile redirect to subdomain

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
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 …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now