Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. No Profile Picture
    Contributing User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Feb 2014
    Posts
    35
    Rep Power
    4

    How to Redirect non www. to www.


    Hello,

    I'm having trouble, with redirecting our site from a non www. to the www.

    Currently I've built the pages in dream weaver and put them live via a FTP program individually. NO CMS

    Ive search in Google for the solution, before asking the question myself

    Ive come across this code.

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

    Do i place my Host in {HTTP_HOST}

    I've added it to one of the pages as it is, but it doesn't seem to work, and the code is visible so i can only guess my understanding of where it needs to be placed isn't correct.

    Apparently it needs to be added to the HTaccess file, which i am unable to find. How do i go about resolving the issue?
  2. #2
  3. SEO Insultant
    SEO Chat Mastermind (5000+ posts)

    Join Date
    Oct 2005
    Location
    sharing a room with my ego
    Posts
    6,299
    Rep Power
    3044
    Is yours a Windows server or a Linux one?
  4. #3
  5. No Profile Picture
    Contributing User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Feb 2014
    Posts
    35
    Rep Power
    4
    I couldn't answer what sort of server it is as we host with Heart Internet and don't have a server in house
  6. #4
  7. SEO Insultant
    SEO Chat Mastermind (5000+ posts)

    Join Date
    Oct 2005
    Location
    sharing a room with my ego
    Posts
    6,299
    Rep Power
    3044
    Ummm web-sniffer.net should be able to tell you.

    You don't need to tell us your domain if you don't want to, but if you do, it's best to "obfuscate" it for various reasons
  8. #5
  9. No Profile Picture
    Contributing User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Feb 2014
    Posts
    35
    Rep Power
    4
    Apache/2.4.6 (Unix)

    Thats what web sniffer came back with
  10. #6
  11. SEO Insultant
    SEO Chat Mastermind (5000+ posts)

    Join Date
    Oct 2005
    Location
    sharing a room with my ego
    Posts
    6,299
    Rep Power
    3044
    In that case you may have to make a NEW .htaccess file (if it doesn't exist yet).

    That said: at first glance your code looks a bit dodgy. I wouldn't upload it just yet. It might work but it doesn't look like anything I've seen so far.
  12. #7
  13. SEO Insultant
    SEO Chat Mastermind (5000+ posts)

    Join Date
    Oct 2005
    Location
    sharing a room with my ego
    Posts
    6,299
    Rep Power
    3044
    Hm it might just work

    Don't forget to test (quickly) and then take it down if it doesn't do the job.

    You can probably make a new .htaccess file easily via your CPanel's file manager.
    Last edited by dzine; Feb 25th, 2014 at 10:23 AM.
  14. #8
  15. No Profile Picture
    Contributing User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Feb 2014
    Posts
    35
    Rep Power
    4
    You been looking at my website? lol

    Yeah it isn't the best! ill admit that! where do i upload the htaccess file to? i only have access to the site in my FTP
  16. #9
  17. SEO Insultant
    SEO Chat Mastermind (5000+ posts)

    Join Date
    Oct 2005
    Location
    sharing a room with my ego
    Posts
    6,299
    Rep Power
    3044
    An .htaccess file goes in the root. It's a standard text file, but the thing is that the filename is non-standard. As in: it's only an extension, without a real filename. Consequently: Windows always throws a hissy fit whenever you want to handle/edit/upload such a file.

    P.S.: LOL I was talking about your htaccess code (which I've never come across before but which might still work well). I have no issues with your website, since I dunno what it is
  18. #10
  19. No Profile Picture
    Contributing User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Feb 2014
    Posts
    35
    Rep Power
    4
    I thought you where someone from the matrix or something then! that proper confused the hell out of me!

    Right so how do i find this if i only have FTP access? In fact how can you find it but i cant! are you from the matrix?

    ive found a htaccess generator, that says you pretty much bang in all your needs and it will generate it for you and all you have to do is upload it... but i really don't think its going to be that simple!
  20. #11
  21. Seo Control Panel
    SEO Chat Discoverer (100 - 499 posts)

    Join Date
    Feb 2014
    Location
    India
    Posts
    141
    Rep Power
    12
    Add following code to .htaccess, it will fix the issue. I am already using it.

    RewriteEngine on
    rewritecond %{http_host} ^example.com [nc]
    rewriterule ^(.*)$ http://www.example.com/$1 [r=301,nc]
    Replace example.com with your website.

    Hope this will help you
  22. #12
  23. No Profile Picture
    Contributing User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Feb 2014
    Posts
    35
    Rep Power
    4
    That code doesn't work, it takes the site down, as it gets stuck in a loop across all the pages?
  24. #13
  25. SEO Insultant
    SEO Chat Mastermind (5000+ posts)

    Join Date
    Oct 2005
    Location
    sharing a room with my ego
    Posts
    6,299
    Rep Power
    3044
    That's weird, because the code looks sorta legit.

    How did you make and upload the .htaccess file in the end?
  26. #14
  27. Seo Control Panel
    SEO Chat Discoverer (100 - 499 posts)

    Join Date
    Feb 2014
    Location
    India
    Posts
    141
    Rep Power
    12
    Originally Posted by carbs4me
    That code doesn't work, it takes the site down, as it gets stuck in a loop across all the pages?
    Yes it is working in my site. Can you paste your .htaccess content here.
  28. #15
  29. No Profile Picture
    Contributing User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Feb 2014
    Posts
    35
    Rep Power
    4
    Hello Guys,

    Cheers for your help, i worked out that i didn't place . at the begining of the htaccess file.

    The code is good it worked cheers.

    I only only have one issue. i have 2 versions of my homepage i have for example homepage/ and homepage/index.html

    Is there any quick fixes for that?
Page 1 of 2 12 Last
  • Jump to page:

Similar Threads

  1. 301 Redirect Help
    By bigdog1086 in forum Google Optimization
    Replies: 1
    Last Post: Oct 12th, 2012, 10:38 AM
  2. 301 Redirect
    By garby74 in forum Google Optimization
    Replies: 3
    Last Post: Nov 24th, 2010, 07:39 AM
  3. How to redirect from abc.com to xyz.com
    By indiaparenting in forum Search Engine Optimization
    Replies: 2
    Last Post: May 20th, 2008, 04:10 AM
  4. 301 redirect or 302 redirect for google
    By rajput_jitendra in forum Google Optimization
    Replies: 10
    Last Post: Jun 6th, 2006, 03:43 AM
  5. 301 redirect:.htaccess and php redirect?
    By lilyfok in forum Google Optimization
    Replies: 3
    Last Post: May 3rd, 2006, 09:46 AM

IMN logo majestic logo threadwatch logo seochat tools logo