We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6146
    • 48 Posts
    This is more of an .htaccess question that a MODX question, but any help would be appreciated.

    I have Evo 1.0.5 site where the client wants to have a number of pages in a micro site as a separate subdomain. I have this all the pages working as another folder under the existing Evo site tree. But I cannot make it work as a subdomain.

    Basically, I want the pages here:
    http://www.mydomain.com/subdomain/

    To work when the user goes here:
    http://subdomain.mydomain.com/

    My current .htaccess file does not work but looks like this:
    RewriteEngine On
    
    # the part I think is broken or in the wrong place
    RewriteCond %{HTTP_HOST} ^subdomain\.mydomain\.com
    RewriteRule ^(.*)$ /subdomain/$1 [L]
    
    # rewrite non-www to www
    RewriteCond %{HTTP_HOST} .
    RewriteCond %{HTTP_HOST} !^www\.mydomain\.com [NC]
    RewriteRule (.*) http://www.mydomain.com/$1 [R=301,L]
    
    # 301 Redirects
    RewriteRule ^oldfile.htm(?!l) 	http://www.mydomain.com/modxalias.html		[L,NE,R=301]
    #  bunch more like this one
    
    # Excluded directories from rewrite rules
    RewriteRule ^(manager|assets|blog) - [L]
    
    # The Friendly URLs part
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    


    Thanks in advance.

    Sorry that the forum editor sticks anchors on the urls in my code text. [ed. note: curmudgeon61 last edited this post 14 years, 7 months ago.]
      • 36404
      • 307 Posts
      hi,

      well, actually, it's not only an htaccess issue
      in the htaccess, the only thing you need to do is to add the subdomain directory in the excluded directory list as it's the case for the blog currently

      then, if you want to be able to navigate with http://subdomain.yourdomain.com you have to create a subdomain in your hoster admin/panel or whatever it is smiley

      have swing
        réfléchir avant d'agir