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.

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:
    14,452
    Likes Received:
    195
    Trophy Points:
    63
    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.
     
  3. storminternet

    storminternet Well-Known Member

    Joined:
    Nov 2, 2011
    Messages:
    462
    Likes Received:
    0
    Trophy Points:
    16
    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]
     
  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:
    462
    Likes Received:
    0
    Trophy Points:
    16
    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.
     
  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:
    14,452
    Likes Received:
    195
    Trophy Points:
    63
    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.
     
  8. quietFinn

    quietFinn Well-Known Member

    Joined:
    Feb 4, 2006
    Messages:
    998
    Likes Received:
    10
    Trophy Points:
    18
    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.
     
Loading...

Share This Page