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 7 of 7
  1. #1
    Regular Coder
    Join Date
    Apr 2010
    Posts
    417
    Thanks
    4
    Thanked 1 Time in 1 Post

    change site visitor views

    how do i make it so visitors get rerected from site.com to www.site.com so visitors only use the www.site.com

    been told that i need to add something to the .htaccess file to make this so.

    what is this ?

  • #2
    Regular Coder
    Join Date
    May 2011
    Posts
    241
    Thanks
    1
    Thanked 57 Times in 56 Posts
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^site.com
    RewriteRule ^(.*)$ http://www.site.com/$1 [R=301,L]

  • #3
    Regular Coder
    Join Date
    Apr 2010
    Posts
    417
    Thanks
    4
    Thanked 1 Time in 1 Post
    Quote Originally Posted by gvre View Post
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^site.com
    RewriteRule ^(.*)$ http://www.site.com/ [R=301,L]
    thank you, but how do i get the visitor to be sent to the page they were trying to view first
    say they type in

    site.com/mypage.html they get sent to www.site.com

  • #4

  • #5
    Regular Coder
    Join Date
    Apr 2010
    Posts
    417
    Thanks
    4
    Thanked 1 Time in 1 Post
    sorry this has gone over my head, all i done was copied to code you gave to the top of my .htaccess page and changed the domain names

    where do i put the $1 ?

  • #6
    Regular Coder
    Join Date
    Apr 2010
    Posts
    417
    Thanks
    4
    Thanked 1 Time in 1 Post
    ok i see i did not have the $1 after the /

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

    but still i am always taken to the home page being www.site.com

    if i was to visit say

    site.com/mypage.html i would like the visitor taken to www.site.com/mypage.html
    same for
    site.com/anotherpage.html would take them to www.site.com/anotherpage.html

    and finally site.com/anotherfolder would take them to www.site/anotherfolder

  • #7


  •  

    Posting Permissions

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