Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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:
    151
    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,664
    Likes Received:
    69
    Trophy Points:
    203
    Location:
    SLC
    cPanel Access Level:
    DataCenter Provider
    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^www.yourdomain.com$
    RewriteRule ^(.*)$ http://yourdomin.com/ [R=301,L]
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    168
    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,216
    Likes Received:
    10
    Trophy Points:
    313
    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:
    168
    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:
    168
    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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice