Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to tell apache to return the word "success" for a specific url without the corresponding file even existing?

share|improve this question

Rewrite the specific url to i.e. succes.php:

RewriteCond %{REQUEST_URI} ^/your-specific-url
RewriteRule .* /succes.php

And put in succes.php:

<?php
header("text/html");
echo "success";
?>

share|improve this answer
    
Thank you, unfortunately I just want it to intercept a url and return "success" without relying on an actual file existing – Dan Jul 27 '10 at 9:58
    
"/your-specific-url" does not need to exist. If you mean you don't want a "success.php" then I don't know.. :) – Oscar Jul 27 '10 at 11:48

Without any file existing on the server? No. Apache is a great web server, but that's really all it does - serve files (or dynamic content through modules, but the concept is essentially similar). A quick read of the mod_rewrite documentation seems to indicate that something like this:

RewriteRule ^/someurl - [R=204]

should respond to a web request with a "success, no content" HTTP status code. Not exactly what you're after, but might do the trick.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.