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 to a subdirectory

Discussion in 'General Discussion' started by borissvetnikov, May 25, 2004.

  1. borissvetnikov

    borissvetnikov Registered

    Joined:
    May 24, 2004
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Is it leagal to redirect site.com to site.com/subdir?

    Using Cpanel redirects created an infinite loop. Redirection to a subdomain subdir.site.com created an infinite loop as well.

    The redirection worked well via addon domains but I no longer possess one.

    Is there a way to setup this redirection via Cpanel? I read somewere that html and .htaccess redirects are not good for the search enginees or this is not true?
     
  2. jols

    jols Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,111
    Likes Received:
    2
    Trophy Points:
    38
    I would like to know this as well.

    I believe we used to be able to using the Redirects tool in cPanel to redirect any and all traffic to a particular subdirectory, but now I only get the Infinant loop error.

    I KNOW I can set this up manually via .htaccess, but I need to be able to tell our hosted customers how they can use their cPanel to do this.

    Still possible?
     
  3. jols

    jols Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,111
    Likes Received:
    2
    Trophy Points:
    38
    Okay, here's the issue, I think:

    We used to be able to use the cPanel Redirects utility to insert just a subdirectory name in the redirect-to field. But now we are forced to insert a whole URL instead. As such, when you insert a URL of this same web site, even though it includes a subdirectory, the apache system will see the domain and evoke the redirect again, thus the infinate loop.

    Is there any way we can just use a cPanel tool to direct ALL traffic to a subdirectory?
     
  4. InstaCarma_Tech

    InstaCarma_Tech Well-Known Member

    Joined:
    Apr 22, 2009
    Messages:
    228
    Likes Received:
    1
    Trophy Points:
    18
    You can try using iframes in your .htaccess or integrate in your index file.

    Code:
    <html>
    <body>
    <iframe src = "http://subdomain.domain.com"
    width="100%" height="100%">
    </iframe>
    </body>
    </html>
     
  5. jols

    jols Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,111
    Likes Received:
    2
    Trophy Points:
    38
    Yup, thanks. I am aware of plenty of html tricks to do this, but some of our customers really want those permanent 301 redirects that they used to be able to do straight out of cPanel, using the Redirects tool there.

    I am wondering why cpanel.net took this functionality away, and what we could do to bring it back?
     
  6. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,471
    Likes Received:
    199
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:

    Can you post your .httaccess here after setting up a redirect in cPanel you think should work, but does not?
     
  7. jols

    jols Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,111
    Likes Received:
    2
    Trophy Points:
    38
    Thanks for your help.

    Here's what I had to set up manually to get this to work (in .htaccess):

    --------
    RewriteEngine on

    RewriteCond %{HTTP_HOST} index.html
    RewriteRule ^.*$ "http\:\/\/www\.TrueChange\.net\/main\/" [R=301,L]
    --------

    Now the goal here is to direct all traffic using:
    http://www.truechange.net/

    ... to

    http://www.truechange.net/main/

    However, cPanel now forces one to use a full URL as the target. So when I go to cPanel for this account, and click Redirects, I just put this in the "Redirects to" field:

    http://www.truechange.net/main/

    ... leaving everything else at default, then I click Add.

    The response message on the next page includes this:

    ** All Public Domains **/ redirects to→ http://www.truechange.net/main/

    But when I got to http://www.truechange.net/ I get this in my browser:
    --------------------
    Redirect Loop

    Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
    The browser has stopped trying to retrieve the requested item. The site is redirecting the request in a way that will never complete.
    --------------------

    ... and here is the requested scripting that cPanel inserts in the .htaccess file:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^.*$
    RewriteRule ^.*$ "http\:\/\/www\.truechange\.net\/main\/" [R=301,L]



    Is there a solution for this?
     
  8. xisn

    xisn Well-Known Member

    Joined:
    Dec 4, 2004
    Messages:
    128
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    I know this is a little old but I am also seeing issues with this... In your htaccess file change the first part of the last line...

    This is your current:

    Code:
    RewriteRule ^.*$ "http\:\/\/www\.TrueChange\.net\/main\/" [R=301,L]
    

    Make it look like this:
    Code:
    RewriteRule [COLOR="Red"][B]^/?$[/B][/COLOR] "http\:\/\/www\.truechange\.net\/main\/" [R=301,L]
    
     
  9. Sucesso

    Sucesso Registered

    Joined:
    Jul 8, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Wow, that worked great. I was having the same problem; this fixed it for me.

    Is there a way to do this from cPanel?
     
  10. jols

    jols Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,111
    Likes Received:
    2
    Trophy Points:
    38
    Regarding "Is there a way to do this from cPanel? " and YES, this was the original intention of my post. At one time we could indeed do this from cPanel but no more. Apparently cPanel put in a limit, into their Redirect tool that demands use of a full URL, rather than just specifying a sub-directory.

    We need a method in cPanel that would enable a user to direct ALL web traffic to a sub-directory. Dear cPanel techs, please re-enable this feature!

    Thank you.
     
  11. Sucesso

    Sucesso Registered

    Joined:
    Jul 8, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Yes, I would like to be able to do this from cPanel as well.
     
Loading...

Share This Page