We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36926
    • 701 Posts
    Hi Quick question.

    I have the following redirect rule

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^mydomain\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.mydomain\.com$
    RewriteRule (.*) http://mysubdomain.mydomain.com/$1 [R=301,L]
    


    Which is redirecting uses to the main domain to a subdomain, but I don’t want this rule to be applied if they visit any other directory. For example www.mydomain.com/manager

    Any suggestion on how to do this.

    Thanks

    Ben
      • 33337
      • 3,975 Posts
      You will notice that there is a ht.access file in the manager, just rename it to .htaccess. If not, create a new .htaccess in manager and put this in it:
      RewriteEngine Off
        Zaigham R - MODX Professional | Skype | Email | Twitter

        Digging the interwebs for #MODX gems and bringing it to you. modx.link
        • 36926
        • 701 Posts
        Quote from: zi at Apr 08, 2011, 01:11 AM

        You will notice that there is a ht.access file in the manager, just rename it to .htaccess. If not, create a new .htaccess in manager and put this in it:
        RewriteEngine Off


        Perfect, thanks Zi!!

        Out of interest, do you know if there is a way to limit the redirect via the root .htaccess file. As say you have a large number of directories. Or would you have to create a .htaccess file for each one?

        Thanks

        Ben
          • 33337
          • 3,975 Posts
          This might help:

          # Exclude /assets and /manager directories and images from rewrite rules
          RewriteRule ^(manager|assets)/*$ - [L]


          For more details, plz check on mod_rewrite docs. smiley
            Zaigham R - MODX Professional | Skype | Email | Twitter

            Digging the interwebs for #MODX gems and bringing it to you. modx.link
            • 36926
            • 701 Posts
            Quote from: zi at Apr 08, 2011, 03:20 PM

            This might help:

            # Exclude /assets and /manager directories and images from rewrite rules
            RewriteRule ^(manager|assets)/*$ - [L]


            For more details, plz check on mod_rewrite docs. smiley

            Thanks for you help Zi