Solved

php .htaccess query

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
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…
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 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 …

863 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

25 Experts available now in Live!

Get 1:1 Help Now