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!

Directory redirect to outside public_html

Discussion in 'General Discussion' started by egemenk, Apr 9, 2013.

  1. egemenk

    egemenk Member

    Joined:
    Feb 9, 2013
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    I want to allow users to redirect directory mydomain.com/folder1 to public_html/../folder1. Is this possible?
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,585
    Likes Received:
    439
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    cPanel > Domains section > Redirects, is where you'll find the means to do this.

    Select your domain, add the directory name. In the Redirects to-> add the full URL to the new directory.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. storminternet

    storminternet Well-Known Member

    Joined:
    Nov 2, 2011
    Messages:
    460
    Likes Received:
    0
    Trophy Points:
    66
    cPanel Access Level:
    Root Administrator
    public_html is the root folder of any domain. If you access mydomain.com/folder1 then apache will display contents of folder1.
    If you are looking to redirect URL mydomain.com/folder1 to any other folder then use 301 redirect rule in .htaccess of 'folder1'.
    A sample redirect rule is given below.

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) http://www.mydomain.com/folder2/$1 [R=301,L]
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. egemenk

    egemenk Member

    Joined:
    Feb 9, 2013
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Sorry if I'm not being clear. I want to redirect to a directory other than 'public_html'. For example when a sub-domain is created, it can be a directory outside the 'public_html', in user home directory. I want to do the same thing for mydomain.com/somefolder. I think what I want is the same thing as an Apache directory alias.
     
  5. storminternet

    storminternet Well-Known Member

    Joined:
    Nov 2, 2011
    Messages:
    460
    Likes Received:
    0
    Trophy Points:
    66
    cPanel Access Level:
    Root Administrator
    When you create subdomain it's folder will be resides into public_html. In other words it is sub folder of public_html.
    You just need write redirect rule in .htacess of the folder which you want to redirect to other folder.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. egemenk

    egemenk Member

    Joined:
    Feb 9, 2013
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    @storminternet: From what I have experienced, it's possible that sub-domain folders can reside outside 'public_html'. Please check this screenshot:

    Capture.PNG

    It simply resides under the home directory.
     
  7. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,585
    Likes Received:
    439
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Interestingly enough, googling that term I come up with this, first listing:
    Mapping URLs to Filesystem Locations - Apache HTTP Server

    There is no easy way for a cPanel user to do this I don't believe.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. quietFinn

    quietFinn Well-Known Member

    Joined:
    Feb 4, 2006
    Messages:
    998
    Likes Received:
    11
    Trophy Points:
    168
    Location:
    Finland
    cPanel Access Level:
    Root Administrator
    That is not true.
    cPanel only suggests a subdirectory of public_html, but it can reside anywhere in /home/CPANELUSERNAME directory tree.
    Same with addon domains.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
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