apache

mod_rewrite rule

I am new to mod_rewrite and have been using a generator but it doesn't work. This is an example of what I am trying to achieve. The original URL: http://subdomain.domain.com/company.php?test=TES001 The rewritten URL: http://subdomain.domain.com/company/AAA001 Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteRule company/...

Apache wildcard setup -> php script -> htaccess ->scripts... ?

I have apache setup to wildcard direct all unknown trafic to one php script (default documentroot). This php script looks into a database and possibly finds the correct documentroot for the requested domain (or documetroot of the 404 error handler etc..). The problem is, that from within php script I know how to include another script,...

Zend_Router... Zend_Form... Mod_Rewrite... Rewrite URL get value pairs to slashes...

I am submitting a normal <form method="get"> element to the current url... It's part of a search page. The resulting url is below. http://domain.com/module/controller/action/get1/value1/?get2=get2&amp;value3=value3 The problem is I am using <?= $this->url(array('page' => x)); ?> and similar to navigate around but I want to retain the $_...

Set REMOTE_ADDR to X-Forwarded-For in apache

In a situation where Apache is sitting behind a reverse proxy (such as Squid), the cgi environment variable REMOTE_ADDR gets the address of the proxy rather than the client. However, the proxy will set a header called X-Forwarded-For to contain the original IP address of the client so that Apache can see it. The question is, how do we ...

Suppose a server is hosting a video file. Why is it that sometimes, it requires a full download before playing. Sometimes, I can stream it?

Someone told me that some servers configure it that allow streaming of a file. OR Is it a file-encoding problem, not a server configuration problem? Given a link of the video file, how do I check if that person allows streaming (or play only once downloaded) ? Headers? ...

Conditionally choosing OSCP responders in Apache/mod nss

I'm using apache to validate the certificate revocation on multiple client certificates. Many of the certificates are under different CA hierarchies. Normally this is situation is handled by the oscp aia location. However, One of the contraints is that some of the certs do not have ocsp aia locations in their extensions. Therefore in ap...

Restrict content access to logged in users with PHP

I have a LAMP setup and I just want to be able to protect content on the webpage (images,css,videos,etc) so that only logged in users can access it. I realize I can do this easily with .htaccess. However I do not want to use the authentication popup, and I want to be able to use sessions and also be able to logout. I am using php to do...

mod_rewrite causes apache to crash with Rewritemap prg directive

Apache configuration: RewriteEngine on RewriteLock /var/www/lib/rewrite.lock RewriteMap sessionValid prg:/var/www/lib/allow.php I fixed the obvious of setting the file executable, but now it is giving this: [Fri Feb 12 01:55:31 2010] [error] (2)No such file or directory: exec of '/var/www/lib/allow.php' failed But the file clearly...

RewriteEngine off; does ErrorDocument still work?

I'm writing an ISAPI filter for the IIS7 that should map some functionalities of the Apache Mod_Rewrite. The whole rewriting is finished and I now want to implement the ErrorDocument directive. When I do have RewriteEngine off the rewriting is disabled as intended. But how about the ErrorDocument ? How is the default Mod_Rewrite behaviou...

PHP header problem (no, not that problem)

I have quite a strange problem with PHP and Apache on my local testing server. For some reason it keeps stopping sending headers to the browser (I am pretty sure that is the problem anyway). It's not a case of the old 'output already sent' as it was working fine, had the problem, went away after I reinstalled Apache and is now back aga...

Cant access solr XML url from apache php

Hi, I am trying to use apache to access a XML from tomcat url like so: http://localhost:8081/solr-example/select/?q=blah&amp;version=2.2&amp;start=0&amp;rows=10&amp;indent=on However, I am getting a permission denied error. I have tried chown, chmod and chcon on both the tomcat and solr directories and it still gives me the error. I a...

How can I match query string variables with mod_rewrite?

Suppose I have URLs with query string parameters like these: /index.php?book=DesignPatterns&page=151 /index.php?book=Refactoring&page=157 Using mod_rewrite, how can I redirect them to SES URLs like these? /DesignPatterns/151 /Refactoring/157 ...

How can I simulate a non-responding server?

I have a web service which the customers use by inserting an external JavaScript (hosted on my servers). Recently, due to server outage - the external JavaScript became unavailable and my customers' websites came to a crawl as browser didn't load rest of the website until it loaded the JS (it goes into header of the websites). I am try...

Apache ErrorDocument not working for PHP 500 error

I have a number of ErrorDocuments setup in my .htaccess file for errors such as 404, 401, 403 etc which all redirect to my error page but the ErrorDocument set for a 500 error is never displayed when PHP reports a 500. The 500 code is sent to the browser and the output is blank. Is there something special I need to do to enable 500 error...

Can apache be configured to ignore OPTIONS requests?

I run a small webapp for a couple of departments at work, which is very low traffic and doesn't have that many users. It's built on top of Django and uses apache as the web server. I have things configured to email me when any errors occur which until yesterday was a great thing - there aren't many errors, but sometimes the users don't ...

Apache root-relative links

Using apache 2, I have a simple virtual host container: <VirtualHost 127.0.0.1> ServerName developmentServer DocumentRoot /var/www </VirtualHost> The site is accessible, but I'm having trouble using root relative links within the site. I have an 'images' folder that is located at the root level. When I am within a folder or subfol...

Any good reference for JQOM?

Apache Jackrabbit includes some sort of database/archive query mechanism called JQOM. Where is a good place to start learning about what it is and how it works? Thanks in advance. ...

.htaccess 301 redirect problem

I have the following two 301 redirects in my .htaccess file. The first redirect /faq.php works fine but the second one just gets a 404 error. Can anyone suggest why this may be happening? Options +FollowSymLinks RewriteEngine on redirect 301 /faq.php http://www.mysite.com/faqs redirect 301 /reports/index.php?regionid=14 http://www.my...

Apache URL Rewriting with n arguments

I'm doing some URL rewriting and I can accomplish what I need to do with the following: RewriteRule ^([^/]*)/([^/]*)$ index.php?arg1=$1&arg2=$2 [L,QSA] RewriteRule ^([^/]*)$ index.php?arg1=$1 [L,QSA] You get what I'm trying to do here, I basically want to take the full url and parse it into individual arguments. So /blah/test/asdf/hi...

Apache automatically restarting itself every couple of requests

I just started having a problem where Apache will automatically restart after every few requests it receives. It's been working fine for a long time and I'm not sure why this would happen. The only thing I did recently was add an entry to my vhosts file to listen for another virtual host on the IP that it's running on. However, I reset t...