ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

MSM and repeating subfolder name in URL

December 10, 2012 12:27am

Subscribe [1]
  • #1 / Dec 10, 2012 12:27am

    flipsidenz

    1 posts

    Hi,

    I have a EE 2 MSM setup on a server. I have three domains pointing to the public_html folder, with htaccess controlling where to redirect the domains to which subfolder.

    An issue arises where I have a URL such as:

    http://www.mydomain.com/mydexpress

    Where “myd” also happens to by the name of the subfolder the site in question is sitting within.

    /public_html/
        /myd/
        Sitefiles…

    Expression Engine strips out the “myd” part of the URL above and tries to serve me content from http://www.mydomain.com/express

    This is undesired, as I have a bunch of URL’s starting with “myd”. It’s too late to rename the folder as I have an extremely complex site setup under that subfolder and I do not want to think about the effort required to rename that folder without breaking anything.

    Can anyone help? I have listed some htaccess rules, which may be impacting all of this? Any feedback would be welcome!

    htaccess at /public_html/ level….

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
    RewriteRule ^(.*)$ myd/$1 [L]
    RewriteCond %{HTTP_HOST} ^(www.)?mydomain2.com$
    RewriteRule ^(.*)$ myd2/$1 [L]
    RewriteCond %{HTTP_HOST} ^(www.)?mydomain3.com$
    RewriteRule ^(.*)$ myd3/$1 [L]

    htaccess at /public_html/myd/ level…

    # BEGIN ExpressionEngine Rewrite
    
    #index.php has been removed from Admin > General Configuration 
    
    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /
    
      # Redirect index.php Requests
      # ------------------------------
      RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
      RewriteCond %{THE_REQUEST} !/myd/system/.*
      RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L]
    
      #------------------------
      # Force the website to redirect to the non www. version of the site
      #------------------------
      RewriteCond %{HTTP_HOST} ^www\.mydomain\.com [NC]
      RewriteRule (.*) <a href="http://mydomain.com/$1">http://mydomain.com/$1</a> [R=301,L]
        
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
      RewriteRule ^(.*)$ /index.php?$1 [L]
    </IfModule>
    
    # END ExpressionEngine Rewrite

    Any help would be greatly appreciated. This issue is driving me bonkers!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases