apache

Can Apache Solr output HTML instead of XML?

The question is simple - we have a sample / test Solr app running that only responds with XML right now. Is there an easy way to change that output to HTML? Running Tomcat as the app server. ...

What causes Apache Environment Variable set using mod_rewrite to have "redirect_" appended to name?

I am trying to set Apache environment variables (for use in PHP) with the [E=VAR:VAL] flag on RewriteRule rules in an .htaccess file. I have already discovered the variables are accessed in PHP as server variables $_SERVER rather than $_ENV (which makes a certain amount of sense). However, my problem is for some rules the [E=VAR:VAL] fl...

Setting REMOTE_USER for apache logs using php

In mod_perl i can do something like: $r->user("username"); And then the username will show up in the username section in the logs. Is there a way to do this in php? without having to modify apache? Edit: So far i've tried both: $_SERVER['REMOTE_USER'] = "username"; $_SERVER['PHP_AUTH_USER'] = "username"; apache_setenv('REMOTE_USER'...

Redirect with htaccess for images onto another server without redirect looping

Hey guys, I currently have a host where my main site is hosted on. I have set up nginx on another server to mirror/cache files being requested if it doesn't have it already, in particular images and flv videos. For example: www.domain.com is my main site. www.domain.com/video/video.flv www.domain.com/images/1.png I would like to as...

Apache redirect problem?

I have a asp .net web service running on my machine which I'm accessing from a client iphone application. The process runs fine when I run service methods using my IP address. I wanted to set the address to a domain and set the domain to redirect to the IP address. The redirection works fine when I just want to view the service, ie http...

htaccess turn on php flags if certain IP address

In my .htaccess file I need to turn on the following: php_flag display_errors On php_value error_reporting 2147483647 However I only want to do this if my IP is visiting the site. Any ideas? Something like... if (ip == "x.x.x.x") { php_flag display_errors On php_value error_reporting 2147483647 } Need to do this in .htaccess ...

How to pre-compress very large html files

Hi, I need to pre-compress some very large html/xml/json files (large data dumps) using either gzip or deflate. I never want to serve the files uncompressed. They are so large and repetitive that compression will probably work very very well, and while some older browsers cannot support decompression, my typical customers will not be usi...

What to use as "spam-filter" when sending emails with PHP mail() ?

I have a classifieds website, and on each classifieds page, there is a form for tipping a friend where you just enter the persons email-adress and the tip will then be sent. The form is submitted to tip.php where all "magic" happens with checking and sanitizing etc etc... Lastly I use php:s mail() function to send the email from tip.php...

Apache Rewrite - put parts of query string in replacement string

Hello, I'd like to rewrite: www.example.com/file.html?username=john&number=1234 To: www.example.com/users/john But I can't figure out how to extract the "username" value from the query string. I've been Googling this all morning and reading the official docs but no luck. I need to solve this problem with a rewrite, rather than chang...

Make Apache to show different index.html also in browser's address bar

I have the following foloder tree on my shared hosting server: www.somesite.com | |_ public_html (document folder) |_ .htaccess (Apache file) |_ index.html (page shown by server now when someone looks for www.somesite.com) | |_ site_editor (folder) | |_login.html (site editor control panel) | |_file1.php ...

Apache serving wrong Content-Type for Rails files

Apache keeps serving up my Rails files with a Content-Type of 'text/plain' in the header. I have mod_mime installed, a mime.types files with all the correct MIME assignments, and the following code in my configuration. Any thoughts? DefaultType text/plain <IfModule mime_module> TypesConfig /etc/apache2/mime.types AddType applic...

Segmentation fault when accessing a PHP page

Sometimes when one of our Apache web servers is restarted, we experience segmentation faults when any PHP page is subsequently accessed. The following line is printed in the httpd error_log: [Wed Jun 16 10:59:33 2010] [notice] child pid 31513 exit signal Segmentation fault (11) There will be one of these lines for each PHP page that is...

customize web application root context in apache

Hi, I have web application abc.war and I want to deploy it on Apache Tomcat. The problem is that, by default, the path to this application is http://&lt;server-name&gt;/abc but I want to access it as http://&lt;server-name&gt;/xyz. I put into WAR's META-INF folder the file context.xml that is : <Context path="/xyz" docBase="abc" ove...

Using .htaccess to replace backslash in URL with forward-slash

I realise that a backslash should never appear in a URL in a form other than a URL escape code, however in this case the URL's are being generated by a .NET application for generating flashbooks. I have contacted the developer of this application with a bug report. In the interim i would like to use .htaccess to rewrite the offending b...

mod_rewrite to make a short URL

I have a url like: http://skepticalgamer.com/category/slam-the-controller I'd like to strip out "category" from the URL. So I'd want: http://skepticalgamer.com/slam-the-controller to act as if it were the original URL above. Is that something that can be done with mod_rewrite? ...

LDAP query using Python: always no result

I am trying to use python to query LDAP server, and it always returns me no result. and anyone help me find what wrong with my python code? it runs fine without excpetions, and it always has no result. i played around with the filter like "cn=partofmyname" but just no luck. thanks for help import ldap try: l = ldap.open("server")...

Running Ruby app on Apache

I have been learning Ruby lately, and I want to upload a test web application to my server. But I can't figure out how to get it to run on my shared hosting. My Hosting Details Shared Hosting with JustHost (see here for list of features) OS: Linux Apache: 2.2.11 cPanel: 11.25.0-STABLE No SSH access. Can install Ruby Gems. Can't instal...

mod_rewrite - strange [R] behavior

Hello! I'm doing something very simple with mod_rewrite and it's behaving strange. It's behaving as if I'm using the [R] option, but I'm not. Here's a simple test for a .htaccess file: RewriteEngine on RewriteRule ^page1$ page2 This should redirect a request for page1 to page2, but leave the URL in the web browser still pointing to p...

What's the header file for BasicHttpRequest

What's the header file for BasicHttpRequest? I am using Apache HttpComponents. I'm trying to make a simple program, but I am getting this error: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.http.impl.client.AbstractHttpClient.(AbstractHttpClient.java:159) at org.ap...

Trailing slashes: yes or no?

Hello. I'm working on a new project, using Apache's mod_rewrite and PHP to get pretty URLs. Here's what my URLs look like: http://example.tld/foo/bar/1/etc Notice that there's no trailing slash (that's the way I write it in the href attributes of <a>s). However, I'm also allowing http://example.tld/foo/bar/1/etc/ (trailing slash). I...