Results 1 to 9 of 9

Thread: Subdomain in Contao Help Requested

  1. #1
    User
    Join Date
    09-08-09.
    Location
    Snellville, GA
    Posts
    194

    Default Subdomain in Contao Help Requested

    I'm working with a client and we're experimenting with subdomains on a Contao 2.9.5 install for SEO purposes. I'm having a problem trying to get the subdomain to automatically load the initial page as the default. Here are the steps I'm taking to get the subdomain working in Contao (using a Linux/Apache Server):

    1. Setup subdomain in cpanel as in "richmond.permatreat.com"

    2. Per a previous suggestion elsewhere in the Contao Forum, manage subdomain redirection so that redirect goes to:

    Code:
    //typolight
    3. Inside the new "richmond" folder on the server the .htaccess file automatically created by the manage redirection reads:

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^richmond\.permatreat\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.richmond\.permatreat\.com$
    RewriteRule ^/?$ "\/\/typolight" [R=301,L]
    3. Edit the subdomain document root in cpanel to read:

    Code:
    public_html
    4. In Contao, create a new website root page domain in the site structure, I'm calling it

    "Richmond subdomain"

    5. Copy a standard page from the main website site structure into the new subdomain site structure, give it a unique page alias like "richmond-pest-control" , then activate the page as the "Initial Page" for the subdomain, and finally activate the page articles. I can test the page at:

    http://richmond.permatreat.com/richm...t-control.html

    and it works. Provided the page alias is unique for another subdomain, it appears that additional subdomains will work using this scheme as well. Interestingly, any links on the page all load properly in Contao under the "http://richmond.permatreat.com/" subdomain. No problem there and this may in fact be very useful for SEO purposes.

    6. However, when I use the subdomain by itself, as in

    http://richmond.permatreat.com/

    Contao loads the Contao system login page.

    7. MY QUESTION: I assume this is an .htaccess issue, but is there a way to cause the subdomain to load the "richmond-pest-control.html" page as the default if just typing in the subdomain without an alias designated?

    I'm not having much luck with my experimentation here and hope someone else could shed some light on this. If I upgrade the site to Contao 2.10.3 are there any new features there that might be helpful here?

    Any suggestions would be appreciated.

    Ernest McDermon
    Snellville, GA

  2. #2
    User
    Join Date
    06-19-09.
    Posts
    328

    Default Re: Subdomain in Contao Help Requested

    your .htaccess should be replaced with the default Contao .htaccess
    Consulenza Contao CMS https://www.intco.it

  3. #3
    User
    Join Date
    09-08-09.
    Location
    Snellville, GA
    Posts
    194

    Default Re: Subdomain in Contao Help Requested

    Quote Originally Posted by ga.n
    your .htaccess should be replaced with the default Contao .htaccess
    That did NOT work. Anybody else got a suggestion? I'm thinking the generated .htaccess file inside the subdomain folder (needed to setup the subdomain) should have a couple of lines that, if traffic is coming in to

    http://richmond.permatreat.com/

    would load

    http://richmond.permatreat.com/richm...t-control.html

    as the default page. The generated code for the .htaccess file that defines the redirection to "typlight" has to remain other wise the page doesn't load from Contao.

    Ernest McDermon

  4. #4
    User
    Join Date
    06-19-09.
    Posts
    328

    Default Re: Subdomain in Contao Help Requested

    Quote Originally Posted by ernestmcd
    The generated code for the .htaccess file that defines the redirection to "typlight" has to remain other wise the page doesn't load from Contao.
    No, both domains (i.e. Apache VirtualHost) must point to the same folder
    Consulenza Contao CMS https://www.intco.it

  5. #5
    User
    Join Date
    09-08-09.
    Location
    Snellville, GA
    Posts
    194

    Default Re: Subdomain in Contao Help Requested

    Can you be specific with instructions? Can you provide a URL to a live Contao site that has a functioning subdomain that exhibits the behavior I'm looking for that you've created?

    I can create subdomains for a full contao install all day long (used for for product demo sites), and do this all the time. But what I'm doing here is not a full install, just a single page in the subdomain root.

    So far the only way that the subdomain works is as described elsewhere in the forum and doing what I've described above. If the folder is included in the Apache Document root, the subdomain fails. If I truncate the document root to pubic_html and the Apache subdomain redirect is set to //typolight the subdomain works provided the htaccess code in the subdomain is the simple lines above.

    If I load in just the URL for the subdomain, without a properly formatted page alias, the login page to Contao loads. If I load the fully formatted URL for the subdomain with the page alias, the page loads properly.

    I think that the solution lies in either a modification to the generated htaccess file in the subdomain folder, or something has to be added to the main Contao htaccess file to handle this. Its possible that there is some other way to handle the Apache domain root and redirect, but the instructions I found in the forum seem to work. I'm not having any success with any other setup.

    One note: "restricting" the domain in the Contao Subdomain root to "richmond.permatreat.com" makes no difference in the behavior. It STILL loads the Contao login page unless the fully qualified URL with the page alias is entered.

    Does anyone have something that they can contribute?

    I'd appreciate any thoughts or suggestions here, especially if you have actually setup subdomains in Contao.

  6. #6
    User
    Join Date
    06-19-09.
    Posts
    328

    Default Re: Subdomain in Contao Help Requested

    Quote Originally Posted by ernestmcd
    I'm not having any success with any other setup.

    I manage www.zedseries.com and imex.zedseries.com with the same installation and they work as intended.

    The home page of imex.zedseries.com is

    http://imex.zedseries.com/import-export ... o-cms.html

    if you load http://imex.zedseries.com there is no redirect to the "import-export-tool-for-contao-cms.html" page


    if you wish to setup an auto-redirect you can try this:

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^richmond\.permatreat\.com$
    RewriteRule ^/?$ "\/richmond-pest-control.html" [R=301,L]
    Consulenza Contao CMS https://www.intco.it

  7. #7
    User
    Join Date
    09-08-09.
    Location
    Snellville, GA
    Posts
    194

    Default Re: Subdomain in Contao Help Requested

    I think we're getting closer to the solution with your help which I appreciate, but for some reason I can't seem to get specifics from you. Can you provide:

    1. Settings in cpanel for the imex.zedseries.com subdomain. Example:

    Subdomains Root Domain | Document Root | Redirection
    imex.zedseries.com | ?? | ??

    2. In the /richmond subdomain folder, you indicate that I should use the .htaccess.default file. If I just add in the default .htaccess file AS IS, the redirect doesn't work. Are you adding the rewrite rules for the imex subdomain to this file, and if so where and what do they read?

    Thanks in advance,

    Ernest McDermon

  8. #8
    User
    Join Date
    06-19-09.
    Posts
    328

    Default Re: Subdomain in Contao Help Requested

    Quote Originally Posted by ernestmcd
    1. Settings in cpanel for the imex.zedseries.com subdomain. Example:

    Subdomains Root Domain | Document Root | Redirection
    imex.zedseries.com | ?? | ??
    I do not use cpanel, my configuration is the following:

    VirtualHost: zedseries.com
    DocumentRoot: /home/domains/zedseries.com

    VirtualHost: imex.zedseries.com
    DocumentRoot: /home/domains/zedseries.com

    please note that the two Document Root are the same, there is no need for redirection because Contao load the correct page by itself

    Quote Originally Posted by ernestmcd
    2. In the /richmond subdomain folder, you indicate that I should use the .htaccess.default file. If I just add in the default .htaccess file AS IS, the redirect doesn't work. Are you adding the rewrite rules for the imex subdomain to this file, and if so where and what do they read?
    I have no equivalent of "richmond subdomain folder" the two domains (the correct name is VirtualHost) must point to the same directory

    I edited my .htaccess so if an user load http://imex.zedseries.com, it will be redirected to
    http://imex.zedseries.com/import-export ... o-cms.html

    I order to achieve this I just added the following lines in my .htaccess file:

    Code:
    # change this to ^richmond\.permatreat\.com$
    RewriteCond %{HTTP_HOST} ^imex\.zedseries\.com$
    
    # change this to "\/richmond-pest-control.html" [R=301,L]
    RewriteRule ^/?$ "\/import-export-tool-for-contao-cms.html" [R=301,L]
    
    
    # the lines below are the last entries in the Contao .htaccess file
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .*\.html$ index.php [L]
    Consulenza Contao CMS https://www.intco.it

  9. #9
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Subdomain in Contao Help Requested

    I found this topic looking how to setup subdomains, but because I was unsure of the steps tried aliasing first. That worked for me, and for as far as I can see also seems to do as the ts requests, so could be an alternative answer?

    Here's what I did:
    • Using Plesk I created a domain alias to domain.com called example.domain.com[/*:m:3vuf2iqe]
    • In Contao adding the new rootpage for example.domain.com[/*:m:3vuf2iqe]


    I guess this is similar to ga.n's virtual host solution as that would roughly do the same thing; let two different names point to the same place.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •