Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: .htaccess issue

  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    .htaccess issue

    I want to redirect my blog (example.com) to (www.example.com).
    That's simple right, just use the .htaccess rules
    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www\.example\.com
    RewriteRule (.*) http://www.example.com/$1 [L,R=301]
    NOW THE PROBLEM IS I want to host a mobile version of my blog and I want to use (m.example.com) as the url. But the above .htaccess rules redirect (m.example.com) to (www.example.com)

    ANY IDEA HOW TO AVOID THIS SITUATION.
    m.example.com is a CNAME which my wordpress plugin uses to point my blog to mobile theme. It is not a sub-domain.
    Last edited by coolankur49; 01-12-2012 at 08:49 PM.

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Just add another condition so it ignores m.example.com:
    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www\.example\.com
    RewriteCond %{HTTP_HOST} !^m\.example\.com
    RewriteRule (.*) http://www.example.com/$1 [L,R=301]


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •