The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Redirect from http://www.myadress.com to http://myadress.com

Discussion in 'General Discussion' started by apfan, Apr 2, 2006.

  1. apfan

    apfan Member

    Joined:
    Jun 6, 2005
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Iceland
    Is there any kind of code ill could place in the "ht acess" file. To make this redirect possible.

    Regards
     
  2. dalem

    dalem Well-Known Member
    PartnerNOC

    Joined:
    Oct 24, 2003
    Messages:
    2,577
    Likes Received:
    40
    Trophy Points:
    48
    Location:
    SLC
    cPanel Access Level:
    DataCenter Provider
    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^www.yourdomain.com$
    RewriteRule ^(.*)$ http://yourdomin.com/ [R=301,L]
     
  3. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    16
    This looks straightforward enough, but I can't get it to take. It just acts like it's not matching at all, and continues to display the "www" in the URL. Any follow-up tips?

    Thanks.
     
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    The code should be placed in a .htaccess file in the public_html directory (assuming this is the primary domain for that cPanel account).

    Is there any other code in the .htaccess file by chance? I know WordPress in particular wreaks all sorts of havoc with .htaccess files causing redirects and some cPanel functionality relying on .htaccess to not function properly.
     
  5. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    16
    Hi David - No, I'm working in a vhost conf file:

    Code:
    /usr/local/apache/conf/userdata/std/2/news23/news23project.domain.org
    all other apache directives in that file work fine - just not that one.
     
  6. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    16
    Aha! Progress. I realized that it wasn't matching because we needed to be putting these in a

    Code:
    /usr/local/apache/conf/userdata/std/2/news23/[B]www[/B].news23project.domain.org
    directory. Now I've got it working for the base URL but URLs like

    http://www.domain.org/projects

    redirects to the homepage not to /projects. What's wrong with this picture?

    Code:
    # Get useless and ugly www out of the URL
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.domain.org$
    RewriteRule ^(.*)$ http://domain.org/$1 [R=301,L]
    Thanks,
    ./s
     
Loading...

Share This Page