Solved

php .htaccess query

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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

740 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