Solved

php .htaccess query

Posted on 2010-09-03
4
655 Views
Last Modified: 2012-05-10
I have a GODADDY hosting account which holds several domains.

I have the file structure in the background as

/ (root folder which contains the main domain files
/_websites/ (other website domain files here)

I have several websites, one of which is cubecart4, the others are joomla 1.5. I am trying to get apache rewrite setup on all of these sites, but there is a problem. I am not able to configure each with their own, completely different .htaccess file as they insist on using the one at the root.

So I have a .htaccess file setup in the root container and all my joomla sites quite happily use this, and work fine. If I try to put a HTACCESS file in each sites virtual root (i.e /_websites/domain.com/.htaccess they will not use it and just give internal server errors.

However, I cannot install a .htaccess for my cubecart site. I tried to put it in the root of the site and it wont work.

Any ideas on how I can set this up without having to get a seperate hosting account for each domain? Is anyone on godaddy hosting several sites on one account with different .htaccess and how was it done?

0
Comment
Question by:mvwmail
4 Comments
 
LVL 2

Expert Comment

by:mainemoose
ID: 33596159
Can you post the rewrite rules for joomla and the rewrite rules for cubecart4?
0
 
LVL 8

Assisted Solution

by:kumaranmca
kumaranmca earned 100 total points
ID: 33596284
Greetings mvwmail,

I think its not possible. Because each domian as separate .httaccess file...then only do it. other wise its not possible.
0
 
LVL 26

Accepted Solution

by:
arober11 earned 400 total points
ID: 33601484
Easiest solution will be to stick with the one root .htaccess, but group the rules by HOST, then and add a series of SKIP [S=xx] rules to bypass the block if the HTTP_HOST dosen't match the correct value e.g.

#Rules for Site: aaa.bbb.ccc
RewriteCond %{HTTP_HOST}  !aaa.bbb.ccc [NC]
RewriteRule .*  -  [S=11]
...
RewriteRule /dddd/ffff    http://aaa.bbb.ccc/some/other/url [L]
RewriteRule /dddd/yyyy  http://aaa.bbb.ccc/another/url       [L]


#Rules for Site: bbb.ccc.ddd
RewriteCond %{HTTP_HOST}  !bbb.ccc.ddd [NC]
RewriteRule .*  -  [S=22]
...
RewriteRule /dddd/yyyy  http://bbb.ccc.ddd/some/other/url [L]


Just change the S=xx values to to a count of the "RewriteRule" count in the block.
0
 
LVL 3

Author Closing Comment

by:mvwmail
ID: 33609938
That code looks great for future use, but I did find that the lines from the two HTACCESS files for Joomla abnd CUbecart are so different, and unique to the site that they can sit happily in the same HTACCESS file and now all sites have SEF URL's.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question