Solved

php .htaccess query

Posted on 2010-09-03
4
664 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

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…

828 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