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.

Seperate www url from http url to use both urls with different script

Discussion in 'Bind / DNS / Nameserver Issues' started by caylean, Mar 28, 2016.

  1. caylean

    caylean Member

    Joined:
    Jul 2, 2013
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello there,

    I would like to install a multiuser Wordpress in the http:// part of the Domain and another script (Link Directory) in the www part.

    Using www indeed as an own Subdomain. So that I can use http://domain.tld/wp-admin for users to create their subdomain blogs while the http://www.domain.tld/ shows my directory.

    I would LOVE to see a redirect of some kind from only the http://domain.tld to http://www.domain.tld/ if that would be possible.

    Is there any chance that I can have this somehow working in cPanel.. any ideas?

    Kind regards
     
  2. caylean

    caylean Member

    Joined:
    Jul 2, 2013
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I just had a 'working' solution as it seemed.

    PHP:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase 
    /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond 
    %{REQUEST_FILENAME} !-d
    RewriteRule 
    . /index.php [L]
    </
    IfModule>
    # END WordPress

    RewriteCond %{HTTP_HOST} ^www\.domain\.tld$
    RewriteCond %{REQUEST_URI} !^/www/
    RewriteRule (.*) /www/$1
    Wordpress worked and the domain also showed the content of the folder www ... but sadly the linkdirectory didn't worked that way it seemed.

    So i am still looking for a solution that would allow me to use www really like a subdomain.
     
  3. caylean

    caylean Member

    Joined:
    Jul 2, 2013
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I had the urge to dig a bit more and I had found that there was a possible solution where the subdomain configs are stored and I had tried my luck in creating a testsubdomain to see whats the content of these files, to modify it to create a subdomain www...

    Using WinSCP and going to /var/cpanel/userdata/username
    Every file was modified to add the www subdomain
    and the domain.tld/domain.tld.cache was modified that the serveralias was changed from www.domain.tld to domain.tld ....

    After a apache restart, I had indeed a www subdomain in my cpanel that could be edited.

    But as the Skript was still not working, I removed everything and created two index files with the one line "www" and "non-www" to see that my changed worked. Sadly they didn't ... So I somehow miss the place where I can change this last bit in the puzzle I believe. Any ideas where I might be able to find this option to set things the right way?
     
  4. caylean

    caylean Member

    Joined:
    Jul 2, 2013
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Wow, dound a new lead that while checking a bit and I came across the httpd.conf ....

    Downloaded it and found this:

    Code:
    <VirtualHost XX.XXX.XXX.XX:80>
        ServerName domain.tld
        ServerAlias www.domain.tld
        DocumentRoot /home/USERNAME/public_html
        ServerAdmin webmaster@domain.tld
        UseCanonicalName Off
        CustomLog /usr/local/apache/domlogs/domain.tld combined
        CustomLog /usr/local/apache/domlogs/domain.tld-bytes_log "%{%s}t %I .\n%{%s}t %O ."
        ## User USERNAME # Needed for Cpanel::ApacheConf
        UserDir enabled USERNAME
        <IfModule mod_suphp.c>
            suPHP_UserGroup USERNAME USERNAME
        </IfModule>
        <IfModule mod_php5.c>
            php_admin_value open_basedir "/home/USERNAME:/usr/lib/php:/usr/local/lib/php:/tmp"
        </IfModule>
        <IfModule sapi_apache2.c>
            php_admin_value open_basedir "/home/USERNAME:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        </IfModule>
        <IfModule !mod_disable_suexec.c>
            <IfModule !mod_ruid2.c>
                SuexecUserGroup USERNAME USERNAME
            </IfModule>
        </IfModule>
        <IfModule mod_ruid2.c>
            RMode config
            RUidGid USERNAME USERNAME
        </IfModule>
        <IfModule itk.c>
            # For more information on MPM ITK, please read:
            #   http://mpm-itk.sesse.net/
            AssignUserID USERNAME USERNAME
        </IfModule>
    
        ScriptAlias /cgi-bin/ /home/USERNAME/public_html/cgi-bin/
    
        # To customize this VirtualHost use an include file at the following location
        # Include "/usr/local/apache/conf/userdata/std/2_2/USERNAME/domain.tld/*.conf"
    </VirtualHost>
    right below this entry I find (I guess) my strangely created subdomain:

    Code:
    <VirtualHost XX.XXX.XXX.XX:80>
        ServerName www.domain.tld
        ServerAlias www.www.domain.tld
        DocumentRoot /home/USERNAME/public_html/www
        ServerAdmin webmaster@www.domain.tld
        UseCanonicalName Off
        CustomLog /usr/local/apache/domlogs/www.domain.tld combined
        CustomLog /usr/local/apache/domlogs/www.domain.tld-bytes_log "%{%s}t %I .\n%{%s}t %O ."
        ## User USERNAME # Needed for Cpanel::ApacheConf
        UserDir enabled USERNAME
        <IfModule mod_suphp.c>
            suPHP_UserGroup USERNAME USERNAME
        </IfModule>
        <IfModule mod_php5.c>
            php_admin_value open_basedir "/home/USERNAME:/usr/lib/php:/usr/local/lib/php:/tmp"
        </IfModule>
        <IfModule sapi_apache2.c>
            php_admin_value open_basedir "/home/USERNAME:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        </IfModule>
        <IfModule !mod_disable_suexec.c>
            <IfModule !mod_ruid2.c>
                SuexecUserGroup USERNAME USERNAME
            </IfModule>
        </IfModule>
        <IfModule mod_ruid2.c>
            RMode config
            RUidGid USERNAME USERNAME
        </IfModule>
        <IfModule itk.c>
            # For more information on MPM ITK, please read:
            #   http://mpm-itk.sesse.net/
            AssignUserID USERNAME USERNAME
        </IfModule>
    
        ScriptAlias /cgi-bin/ /home/USERNAME/public_html/www/cgi-bin/
    
        # To customize this VirtualHost use an include file at the following location
        # Include "/usr/local/apache/conf/userdata/std/2_2/USERNAME/www.domain.tld/*.conf"
    </VirtualHost>
    Besides that here is the server alias www.www.domain.tld it looks fine.

    The Problem is, when i check the named folder where I should change the stuff: "/usr/local/apache/conf/userdata/std/2_2/USERNAME/domain.tld/*.conf" I end at /usr/local/apache/conf/userdata/std/2_2/ and there is just one other user, not the one I need.

    I could find that I have to create the folders and a *.conf file myself ... so update.conf it would be... but HOW to enter there now my needed updates? Somehow for a newbie there is not really something to be found that one can understand...

    As I had edited all files inside /var/cpanel/userdata/username and used these comands to rebuild httpd.conf

    Code:
    cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak101021
    /scripts/rebuildhttpdconf
    /etc/init.d/httpd restart
    i thought i should be good to go, but still I have http://domain.tld/ und http://www.domain.tld/ connected...

    So this whole thing is very frustrating, as it seemed to be something very easy after I had found these config files... but where does it get stuck?
     
  5. caylean

    caylean Member

    Joined:
    Jul 2, 2013
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Problem solved. I did the right thing, but I had messed up a while ago when I made my first tryouts.

    I expect that somewhere in the beginning I had messed with the DNS Settings (Edit DNS Zone) ....
    because when I terminated the Account and recreated it again, uploaded the modified files
    domain.tld.cache
    domain.tld
    cache
    main
    main.cache
    www.domain.tld.cache
    www.domain.tld
    via SCP and didn't do anything else (because i was searching for solutions)

    So when i had opened the http://domain.tld/ a error was shown.... no content uploaded. So my test files went up again and directly everything worked exactly as I needed it to have it.

    Right now I have uploaded Wordpress and PhpLD ... just need to be installed and the main site of wordpress install gets a php redirect ... i think i'll got everything i was looking for!
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

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

    I am happy to see it's working well. Thank you for updating us with the outcome.
     
  7. caylean

    caylean Member

    Joined:
    Jul 2, 2013
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Well, something is strange... but maybe you guys can help me out.

    I have changed my server, doing what I have done before is still possible, but it has simply no effect.

    So i tried to remove the www subdomain in cPanel and found a message, that lead me here to this old topic: extra www subdomain - and cannot remove!

    Is there a way to savely get EXACTLY that? I WANT the extra folder.. but for some reason I can't get it anymore on the new server and I absolutely don't see the problem here.

    Everything in /var/cpanel/userdata/username looks exactly the way it was before. I went that far and simply took the files from the working server, changed Username and IP adress and uploaded it again.
    Rebuild apache and..... nothing ....

    Did I miss something? did I do something that I did before? I cannot tell. I only know that the things I have done what I described here worked the last time, but this time not.

    But having this Topic about REMOVING what I want... maybe someone can get me the information I am so longing for...
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Could you let us know the specific steps you have taken thus far?

    Thank you.
     
Loading...

Share This Page