if you have access to apache config, don't use .htaccess from apache website:
"In general, you should never use .htaccess files unless you don't have access to the main server configuration file. There is, for example, a common misconception that user authentication should always be done in .htaccess files, and, in more recent years, another miscomception that mod_rewrite <http://httpd.apache.org/docs/trunk/mod/mod_rewrite.html> directives must go in.htaccess files. This is simply not the case. You can put user authentication configurations in the main server configuration, and this is, in fact, the preferred way to do things. Likewise, mod_rewrite directives work better, in many respects, in the main server configuration." On Fri, Aug 20, 2010 at 1:09 AM, Dennis Geurts <[email protected]>wrote: > A possible solution might be as simple as this: > > create a virtualhost in apache2 that points to a particular documentRoot: > > file: /etc/apache2/sites-available/couchdb.example.com > -start------ > <VirtualHost *:80> > ServerName couchdb.example.com > ServerAdmin [email protected] > > DirectoryIndex index.html > DocumentRoot /var/www/couchdb.example.com/htdocs/ > #Options FollowSymLinks > #AllowOverride None > </VirtualHost> > -end------ > > sudo a2ensite couchdb.example.com > sudo /etc/init.d/apache2 reload (or the equivalent for your system) > > then, in /var/www/couchdb.example.com/htdocs/ > > create a file called '.htaccess' > with the following content: > > -start------ > <Files .htaccess> > order allow,deny > deny from all > </Files> > > > <IfModule mod_rewrite.c> > > RewriteEngine on > > #the get options > RewriteRule ^db-name(.*)$ http://localhost:5984/db-name$1 [P] > > </IfModule> > -end------ > > 'curl http://couchdb.example.com/index.html' will load the document > residing at: /var/www/couchdb.example.com/htdocs/index.html > 'curl http://couchdb.example.com/db-name' will load the document residing > at: http://localhost:5984/db-name (i.e. access the couchdb database) > > make sure you have mod_proxy and mod_rewrite enabled! > > > hope this helps, > > Dennis > > > > On 20 aug 2010, at 08:07, Randall Leeds wrote: > > > Ahh. I understand your problem. > > Your html cannot reference :5984, for cross-domain rules (as you > > noted), but instead the path you've forwarded to Couch. > > I'm not an apache wizard. I won't even pretend to try to tell you how. > > But if the example on the wiki and the apache docs is not enough, > > hopefully someone can chime in here or maybe you can find someone on > > IRC if you catch them at the right time. > > > > Asking in a more apache-specific forum might also yield some help. > > Even if they're not familiar with Couch I assume anyone with > > sufficient knowledge of the apache web server should be able to direct > > you to how to get X-domain between virtual hosts, if indeed it's > > virtual hosts that are the key. > > > > Good luck, Dan! And please, when you find out what you were missing > > please tell everyone here and update the wiki with any useful info. I > > have a feeling you're not the first nor the last person to try to set > > this up. > > > > Cheers, > > Randall > > -- PdxBrain <http://www.pdxbrain.com> - I provide Elegant Web Hosting and Domain Registration! <http://hosting.pdxbrain.com> Ask me anything <http://tumble.pdxbrain.com/ask>!
