muzzer Posted July 31, 2014 Share Posted July 31, 2014 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 More sharing options...
Nico Knoll Posted July 31, 2014 Share Posted July 31, 2014 This should be possible in cPanel. You should be able to choose which domain should use which folder. Link to comment Share on other sites More sharing options...
blad Posted July 31, 2014 Share Posted July 31, 2014 I hope this can help you: http://yogeshchaugule.com/blog/2013/how-point-primary-domain-sub-folder-cpanel 2 Link to comment Share on other sites More sharing options...
muzzer Posted July 31, 2014 Author Share Posted July 31, 2014 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 More sharing options...
muzzer Posted August 2, 2014 Author Share Posted August 2, 2014 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] 4 Link to comment Share on other sites More sharing options...
OrganizedFellow Posted August 11, 2014 Share Posted August 11, 2014 Intersting work around. I could use this for something upcoming. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now