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 subdomain

Discussion in 'General Discussion' started by M a H D i, Sep 26, 2016.

Tags:
  1. M a H D i

    M a H D i Registered

    Joined:
    Sep 26, 2016
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    IR
    cPanel Access Level:
    Root Administrator
    Hi Guys;
    I have created a subdomain in my host panel and then redirect it to an IP address in another host.
    now I wanna to force using non-www instead of www in my subdomain.
    how can I do it? and where? in my redirector host or target host?
    example:
    http://www.subdomain.domain.com to http://subdomain.domain.com
    best regards.
     
  2. durangod

    durangod Well-Known Member

    Joined:
    May 12, 2012
    Messages:
    251
    Likes Received:
    10
    Trophy Points:
    18
    cPanel Access Level:
    Website Owner
    M a H D i likes this.
  3. M a H D i

    M a H D i Registered

    Joined:
    Sep 26, 2016
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    IR
    cPanel Access Level:
    Root Administrator
    I've been searching on google I am unable to fix the problem myself, so I have been here

    "sorry for language"
     
  4. durangod

    durangod Well-Known Member

    Joined:
    May 12, 2012
    Messages:
    251
    Likes Received:
    10
    Trophy Points:
    18
    cPanel Access Level:
    Website Owner
    did you look at that link, it shows the code for the htaccess file
     
    M a H D i likes this.
  5. ocbox

    ocbox Member

    Joined:
    Dec 6, 2005
    Messages:
    7
    Likes Received:
    1
    Trophy Points:
    3
    Let's assume your subdomain is chicken and your domain is nuggets

    RewriteEngine On

    RewriteCond %{HTTP_HOST} ^www.chicken.nuggets.com$ [NC]
    RewriteRule ^(.*)$ http\:\/\/chicken.nuggets.com%{REQUEST_URI} [L, R=301]

    That should redirect all your traffic permanently with a 301 to whatever page was requested on www to non-www

    Cheers,
    Jason
     
    M a H D i likes this.
  6. M a H D i

    M a H D i Registered

    Joined:
    Sep 26, 2016
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    IR
    cPanel Access Level:
    Root Administrator
    Hi,

    The steps you've done

    By doing this, I encountered an error when I go to visit "domain.ir" Error: Internal Server Error

    (sorry for language)

    Please find more tips
     

    Attached Files:

  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    Could you let us know the output to /usr/local/apache/logs/error_log when you receive that error message in your browser?

    Thank you.
     
    M a H D i likes this.
Loading...

Share This Page