Jump to content

A Little Htaccess Help Please...


muzzer
 Share

Recommended Posts

Hey, .htaccess is doing my head in. Any help from resident experts would be massively appreciated.

Here's the PW structure;

|--- home
            |--- folderOne
            |--- folderTwo
                  |--- subfolderA
                  |--- subfolderB
                  |--- subfolderC
            |--- folderThree
            |--- etc
 
 

I have two domains and want the following:

  • domain.com should point to the root folder (home template) which it does, standard setup.
  • domainTwo.com (addon domain in cPanel) should point to and render /folderTwo and URL should be http://domainTwo.com
  • the page /folderTwo/subfolderA should be accessable from http://domainTwo.com/subfolderA.

I would have thought the following:

RewriteCond %{HTTP_HOST} domainTwo\.com$ [NC]
RewriteRule ^$ /index.php?it=folderTwo [L,QSA]

This is driving me nuts, Anyone?

 
Link to comment
Share on other sites

Thanks guys, I should have been clearer; I know how to set up tow seperate websites with addon domains in cPanel etc. But in this case both these domains need to use the same PW install/website. So the domainTwo.com which points to /folderTwo still needs to run the index.php in the root folder.

@Nico, If I set up simply as a addon in cPanel wont this mean the root folder is bypassed completely? So /index.php will never be run so PW will never be initialised?

Link to comment
Share on other sites

Solution was simpler than I thought (Thanks @Sumurai8 at Stack Overflow). Damn, .htaccess rewrites screw with my brain.....

   # rewrite the URL: folderTwo/* to http://domainTwo.com/*
   # as we want domainTwo.com/folderTwo to look like domainTwo/
   # this works for any domain, so will rewrite:
   #    http://domain.com/folderTwo/*
   #    http://domainTwo.com/folderTwo/* etc
   # to http://domainTwo.com/*
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^folderTwo/?(.*)$ http://domainTwo.com/$1 [R,L]

   # redirects domainTwo.com to the PW /folderTwo folder
   RewriteCond %{HTTP_HOST} domainTwo\.com$ [NC]
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^(.*)$ /index.php?it=/folderTwo/$1 [L,QSA]
  • Like 4
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...