Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1070085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:30:42+00:00 2026-05-16T20:30:42+00:00

I am trying to redirect blackberry users to my mobile site by doing: #

  • 0

I am trying to redirect blackberry users to my mobile site by doing:

# redirect for blackberry users
RewriteCond %{HTTP_USER_AGENT} ^.BlackBerry.$
RewriteRule ^(.*)$ http://www.domain.com/m/ [R=301]

in my .htaccess, but nothing happens when I try to access from the device, I’ve already deleted cache and cookis and nothing works. I have been googling around and it seems I’m doing the redirect correctly but I guess not, what am I missing?

My .htaccess only contains that by the way.

Edit
The .htaccess in my server’s root.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T20:30:42+00:00Added an answer on May 16, 2026 at 8:30 pm

    If this isn’t the only rule in your .htaccess file, you might have an issue where a later rule messes up your redirect. To redirect immediately, you need to include the L flag.

    I also suspect that your regular expression for the user agent is probably not correct for the input you’re testing against, since the two . match just one character on either side of the word “BlackBerry”. It would also be a good idea to guard against a redirect loop with a check to see if you’re already in /m/ (although if you have mod_rewrite directives in a .htaccess file in that directory it’s not important).

    Putting all of that together, we get something like the following:

    # Check for x-wap-profile/Profile headers
    RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
    RewriteCond %{HTTP:Profile}       !^$ [OR]
    # Check for BlackBerry anywhere in the user agent string
    RewriteCond %{HTTP_USER_AGENT}    BlackBerry [NC]
    # Make sure we're not in /m/ already
    RewriteCond %{REQUEST_URI}        !^/m/
    RewriteRule ^ http://example.com/m/ [R=301,L]
    

    You may also want that RewriteRule to be…

    RewriteRule ^.*$ http://example.com/m/$0 [R=301,L]
    

    …if the content is named the same (but mobile-friendly) in the /m/ directory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to redirect from: http://domain.com/public/photos/large/test.jpg to: http://domain.com/images/public/photos/large/test.jpg on a NGINX environment. My
I'm trying to redirect site.com w.site.com ww.site.com and wwww.site.com to www.site.com. My boss wants
I'm trying to redirect all subdomain requests for domain.com to www.domain.com and user must
I'm trying to redirect all subdomain requests for domain.com to www.domain.com even when the
I am trying to redirect all requests to domain.com/drupal to domain.com, including all sub
I am trying to redirect from this: www.mysite.com/product.html?item=example to: www.mysite.com/example I have this rewrite
I am trying to redirect request for a subdomain to main domain. ie: xxx.domain.com/blah/xyz
Trying to redirect all traffic from www.old-domain.co.uk and old-domain.co.uk to www.new-domain.co.uk on a Wordpress
I'm trying to redirect requests for a wildcard domain to a sub-directory. ie. something.blah.example.com
I'm trying to redirect the URL: http://goalcandy.com/workspace/edit to the following http://goalcandy.com/?module=workspace&editgb=1 And just can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.