Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7027807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:17:50+00:00 2026-05-28T00:17:50+00:00

Lets say I have a file with a .quote extension. I’d like the web

  • 0

Lets say I have a file with a .quote extension. I’d like the web server to send the contents of this file through a simple PHP script before sending it to the browser.

For example:

This is a quote

Would be transformed to

“This is a quote”


It looks as though I need to put something in my .htaccess along the lines of

AddHandler x-quote .quote
Action x-quote /cgi/quote.cgi

And then my script would be something like

#!usr/local/php5
<?php
    header("Content-type: text/plain");

    #I don't know how to do this step...
    echo '"'.$CONTENTS_OF_THE_FILE.'"'; 
?>

However, now I just get an error 404 when I look at the .quote file on the server.
I can think of a few things that might be causing this:

  1. The cgi file is not being found and/or executed – How can I determine if cgi files are allowed to run on my server? Should the path be relative to the webroot?
  2. The path to the php executable is incorrect – Is this listed somewhere in php.ini? If so, where?
  3. I’m not doing the right thing in the PHP itself – What should I be doing

I do not have SSH access to the server in question.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T00:17:51+00:00Added an answer on May 28, 2026 at 12:17 am

    Why not just run it through a normal PHP file rather than CGI and use mod_rewrite?
    Your .htaccess would look like

    RewriteRule ^(.+?).quote$ quote.php?f=$1
    

    Your PHP:

    <?php
    
    header("Content-type: text/plain");
    
    $quote = file_get_contents($_GET['f']);
    echo '"'.$quote.'"';   
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have a few utility functions in file tests/utils/functions.js. I would like
Let's say you have a text file like this one: http://www.gutenberg.org/files/17921/17921-8.txt Does anyone has
Lets say I have a text file with a list of strings like so:
Lets say I have 10 lines in a file. I have 2 parameters that
I'm reading a file using bufferedreader, so lets say i have line = br.readLine();
I have a header file, lets say Common.h, that is included in all of
Let's say I have a text file with the following: line = this is
Lets say I have a file t.txt, a directory t and another file t/t2.txt.
Ok lets say I have a File called File.txt and it contains Hello World
Let's say I have a file called test.txt within the package com.test.io within my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.