apache

Redirect to 404 if .php extension is requested

Hey, When a user requests a page that ends with .php, I want to send them a 404 error even if the page exist. Is that possible to do with .htaccess/mod_rewrite?? http://mysite.com/whatever.php ...

How to get html source of a webpage?

I am using org.apache.http.impl.client.DefaultHttpClient to login to websites through java. How can I get the html source of the webpage after having logged in to a website. ...

What kind of performance gain will I get from ditching Apache for NGINX?

What kind of performance gain will I get from ditching Apache for NGINX if I have a very low traffic web site (e.g. 1000 unique visitors a day, approx 5 requests/sec at highest load, and approx 50 MB of traffic per day since lots of photos are being displayed). Specifically, what gains (if any) would I have for: Loading speed of the w...

Configure mod_jk with mod_rewrite

Dear all Is there any way to configure both mod_jk and .htaccess in a same call what are the steps follow plz replay me httpd.conf ServerAdmin "[email protected]" ServerName www.vpaycash.in MIMEMagicFile /dev/null CustomLog logs/vpaycash.in_access_log "%h %l %u %t \"%r\" %>s %b\"%{Referer}i\" \"%{User-agent}i\"" E...

What are the ways to run a server side script forever?

I need to run a server side script like Python "forever" (or as long as possible without loosing state), so they can keep sockets open and asynchronously react to events like data received. For example if I use Twisted for socket communication. How would I manage something like this? Am I confused? or are there are better ways to impl...

Direct access to result document using Apache XML-RPC

I have Apache XML-RPC up and running fine, but I want to see the full XML response document, not just the return value. According to http://ws.apache.org/xmlrpc/client.html in the Transport Factory section, it says: XmlRpcCommonsTransportFactory -- Another HTTP transport factory, which uses the Jakarta Commons HttpClient. The main advan...

Is it possible to alias a filename on an apache webserver?

Hi, I would like to make e.g. www.address.com/u.exe equal to www.address.com/serverfile.php or pl? Is it possible? So if someone types www.address.com/u.exe should get servefile.php... Thanks for showing the right direction.. This seems to work. RewriteEngine on also had to be added. I had to change .htaccess file RewriteEngine on ...

mod_rewrite help to change Content-disposition based on URI

I have a directory of mp3 files want to have be able to serve them inline or giving the user an option to download based on the request URI. /media/file1.mp3 -- in this case, I just want to serve the file and let the browser play it. /media/download/file1.mp3 -- in this case, I want to make it easy for a user to download the file inst...

Strange behavior in PHP mail function, address does not exist.

I recently had this issue with a client. The code read: ini_set( "sendmail_from", "noreply@<current-domain>.com" ); // $target_email has been validated as a value username. // $subject is a simple String. // $message is an HTML message. mail( $target_email, $subject, $message ); When I tested this on my machine, it worked fine. Whe...

Dealing with multiple, optional parameters with mod_rewrite

I'm using apache's mod_rewrite to make my application's URL's pretty. I have the basics of mod_rewrite down pat - several parts of my application use simple and predictable rewrites. However, I've written a blog function, which use several different parameters. http://www.somedomain.com/blog/ http://www.somedomain.com/blog/tag/ http://...

Configuring Roundup with Apache

I think I just need a bit more guidance than what the documentation gives, and it's quite hard to find anything relating to Roundup and Apache specifically. All i'm trying to do currently is to have Apache display what the stand-alone server does when running roundup-server support=C:/Roundup/ Running windows XP with apache 2.2 and pyt...

How to insert header for every page in a document using apache poi?

I need to read a document and write its content to another file. For this i am using apache poi (getText)which prints the header once at the starting page only. i need to read all the headers at all pages and write to the corresponding file. Is there a way to get all the headers page by page? Also i need to print the page numbers dynamic...

.htaccess, YSlow, and "Use cookie-free domains"

One of YSlow's measurables is to use cookie-free domains to serve static files. "When the browser requests a static image and sends cookies with the request, the server ignores the cookies. These cookies are unnecessary network traffic. To workaround this problem, make sure that static components are requested with cook...

Include ":" character in parameter using Apache's mod_rewrite

I use something like that to pass to the parameter 'text' what follows after the domain RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?text=$1 [L,QSA] So if I have www.example.com/tralala I get $text='tralala' But I want it to be possible to have in the parameter the character ":...

Apache & PHP folder permissions

Hi, Our PHP scripts create dynamic folders and files and we are having a permission issue. The folders were initially create using our ftpuser. EG: Album (created by ftpuser) all subfolders and files in them have to be dynamically created. The apache user is the user when a new folder is created and then it cannot write anything to that...

HTTP Caching, Browser Differences

Esteemed Overflow-ers of the Stack, So I've recently been trying to fully wrap my head around HTTP resource caching. Notably, right now I'm looking at simply the caching of a single, sprited image which is used for rendering icons / small images through out the page. Here's an explanation of the odd behavior I'm seeing: So, on the...

How to force SSL for a checkout link for a webstore

I've browsed through several questions on the site and nothing quite matched what I want to do. I found 1 question that could possible work the best as long as it does neglect SSL on any of the links within the specific folder I want to avoid having SSL on. (http://stackoverflow.com/questions/724968/force-redirect-to-ssl-for-all-pages-a...

Apache Server Timeout with an error message "The page cannot be displayed" for a PHP script.

Hi, I'm trying to redirect output of a simple Perl script to a web browser using PHP. The Perl script sometimes take 2-3 hours to execute and show output to the screen. By this time, I guess Apache Server simply timesout and displays an error message discribed above. Here is the sample code snipet. # The tmpOutput.txt contains outpu...

Improving this url with .htaccess and mod_rewrite

I have a URL I want to shorten with a mod_rewrite. In its ugliest form it looks like: /img.php?i=15&a=92 Ideally it would look like: /img/15/92 The problem is sometimes it might just be: /img.php?i=15 In which case the person will enter: /img/15 So I'm thinking I need a mod_rewrite like this: RewriteRule ^/img/(.*)/(.*)$ /i...

500 error when trying to add expires header to .htaccess

I'm trying to add a far future expires header by editing my .htaccess file this is recommended in the yslow performance rules but when I do, I get a 500 internal server error here's the code I'm using, any body know what's up? ExpiresActive On ExpiresDefault A0 ExpiresByType image/gif A2592000 ExpiresByType image/png A2592000 Expires...