Register in order to access new features like "Job Alert" and "Buyer Alert"

Login

Login
No account yet? Register

Latest Articles

Reverse Auction Factory Banner
Freelancer Jobs arrow Freelancer Jobs - Archive 2007
JobId: #836669

apache Rewrite Rule

Categories: Web,Microsoft Windows,UNIX,Linux,Other (Web),Software Related (Includes Websites)
Posted By: BFranklin  (26 ratings)
Source: Rent-a-coder
Job viewed: 83 times
Bids Placed: 1
Start Date: 2007-12-31 22:23:10
End Date: 2008-01-01 23:20:08
Deadline: Tuesday Jan 1, 2008 10:29:36 PM EDT (1 days after 12/31/2007 10:29:36 PM)
Auction is closed Auction was won by : juanjo  Winning bid: 10.00 USD
Current Phase: 100% of work completed and accepted. Coder has been paid.
Max Accepted Bid: Bidding is closed
Project Type: Very Small Business Project: under $100(USD)
Bid Type: Open Auction
Platform: apache on Windows/Unix/Linux
Description:

Hi,

I'm looking for some help with a mod_rewrite rule for apache.

I have this:

RewriteEngine On
RewriteBase /

#only use rewrite if the file being called does not exist!!!
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^(.*) page.php?page=$1 [L,NE]
RewriteRule ^(.*) sample.php?page=$1 [L,NE]

It redirects all requests for non-existent files to the sample.php page. The problem is that it doesn't pass the querystring values (e.g. after a '?' in the following query:
"http://www.somewhere.com/nonexistentpage.php?id=3"
in this case I'd go to http://www.somewhere.com/sample.php?page=nonexistent.php what I'd like is something like http://www.somewhere.com/sample.php?page=nonexistent.php&id=3 or something similar that I can work with).

I'm looking for the proper rule which redirects as above but which also provides access to the original querystring in some easily used manner.

Thank you for your help!

Best Regards,
John