Solved

php .htaccess query

Posted on 2010-09-03
4
632 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
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 …
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…
The viewer will learn how to dynamically set the form action using jQuery.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now