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 14 of 14

Thread: www or no www

  1. #1
    New Coder
    Join Date
    Nov 2013
    Posts
    33
    Thanks
    2
    Thanked 0 Times in 0 Posts

    www or no www

    Aloha I was wondering how I can make it so that the two links below link to the same page.

    pacrimproperties.com/
    www.pacrimproperties.com/

    The tops one is the right one.

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,784
    Thanks
    6
    Thanked 1,022 Times in 995 Posts
    With htaccess.

    I personally like this one the most:
    Code:
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

  • #3
    New Coder
    Join Date
    Nov 2013
    Posts
    33
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by VIPStephan View Post
    With htaccess.

    I personally like this one the most:
    Code:
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    I just looked at 8 different articals about this but they never explain what/how/were you put that. Do I just add that in the code of my homepage?

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Quote Originally Posted by xris View Post
    I just looked at 8 different articals about this but they never explain what/how/were you put that. Do I just add that in the code of my homepage?
    It goes in the .htaccess file - it is instructions for the Apache web server and not part of any page content.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #5
    New Coder
    Join Date
    Nov 2013
    Posts
    33
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Ok was able to find the file on the host and it was blank so I added what is below and saved the file but when I type out the "www." it does not lead to my homepage yet but with out the "www." it works just fine.

  • #6
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,784
    Thanks
    6
    Thanked 1,022 Times in 995 Posts
    Show us the content of your .htaccess file. Did you set RewriteEngine and RewriteBase? Look at the first two lines in the examples there.

  • #7
    New Coder
    Join Date
    Nov 2013
    Posts
    33
    Thanks
    2
    Thanked 0 Times in 0 Posts
    This is what I have...
    Code:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^pacrimproperties.com$ [NC]
    RewriteRule ^(.*)$ http://pacrimproperties.com/$1 [L,R=301]
    Not that I have any clue as to what it means...lol.

  • #8
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,784
    Thanks
    6
    Thanked 1,022 Times in 995 Posts
    Well, I can tell you that the exclamation mark (!), as in many programming languages, means “not”. So basically you’re addressing all domains that are not pacrimproperties.com which is the exact opposite of what you want.

    Try the one I posted:
    Code:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    And just in case: be aware that the file must be in the root directory of your site.

  • #9
    New Coder
    Join Date
    Nov 2013
    Posts
    33
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Ok so now it said...
    Code:
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    and it is in my root folder but its still linking the www to the wrong page. Is there some place that I have put the name of the domain?

  • #10
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,306
    Thanks
    4
    Thanked 205 Times in 202 Posts
    FWIW here is what I use and it works exactly as desired. As you'll see the domain name is included. There may be ways to solve it but I know this one works

    Code:
    RewriteEngine on
    
    RewriteCond %{HTTP_HOST} ^www.dynacompsolutions.com$                 [NC]
    RewriteCond %{REQUEST_URI} ^/$
    RewriteRule ^(.*)$ http://dynacompsolutions.com/                     [R=301,L]
    Dave .... HostMonster for all of your hosting needs

  • #11
    New Coder
    Join Date
    Nov 2013
    Posts
    33
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I must need to edit the htaccess file that is on the old yahoo host but yahoo does not give you access to that file...could I some how set it up where the old page sends people to the new page?

  • #12
    New Coder
    Join Date
    Nov 2013
    Posts
    33
    Thanks
    2
    Thanked 0 Times in 0 Posts
    No ideas? I can make a log-in account so you can see for yourself that I am doing the htaccess file like I been told to, if that would help at all.

  • #13
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    The dot on the front of the filename means it is a hidden file. It can still be updated the same as any other file, it just doesn't show up on lists of files unless the list includes hidden files.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #14
    New Coder
    Join Date
    Nov 2013
    Posts
    33
    Thanks
    2
    Thanked 0 Times in 0 Posts
    OK i got what the issue was now. When I called the new host to get help moving the dns over to the new server, since I never done that before, they told me to change the "pacrimproperties.com" to the new server ip address but they did not say anything about the "*pacrimproperties.com" or the "ftp.pacrimproperties.com".

    Since I was on the phone with tech support I did not take the time to really read what all was on that page so I had no clue that I needed to change all three. This also explains why I could not get my ftp program to connect to the new site...lol.

    Thanks for all the help and ideas guys.


  •  

    Posting Permissions

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