Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mod_rewrite - is this possible?

Status
Not open for further replies.
Dustman,
Try something like this:
Code:
RewriteEngine on
RewriteCond   /your/docroot/mydir/%{REQUEST_FILENAME} -f
RewriteRule   ^/mydir/(.*)$ /mydir/process.php?url=$1 [F,L]
This will check to make sure the file exists. If it does then it will rewrite the request as you proposed. If the file doesn't exist then it should return a 404 file not found error.

For more info check out the apache url rewriting guide:

Hope that helps get you pointed in the right direction.
 
Hmm.. that still doesn't work. It seems to have no effect at all.

RewriteEngine on
RewriteCond /home/superwag/public_html/dustin/%{REQUEST_FILENAME} -f
RewriteRule ^/dustin/(.*)$ /dustin/process.php?murl=$1 [F,L]


Currently I have one file called homepage.html and then my php file called process.php. I get file not found on any files that aren't there but I get the actual file that I request when I ask for it.. pretty much like nothing happens. All my php script is doing right now is printing "You asked for $murl". Any other ideas?


-Dustin
Rom 8:28
 
Okay, I think I've got it working now. Thanks for the help!

RewriteEngine on
RewriteCond %{REQUEST_URI} !/dustin/process\.php
RewriteRule ^(.*)$ /dustin/process.php?murl=$1 [L]


Now any file or directory I ask for within dustin, will be sent to process.php, where I will check for authorization manually and determine what to do from there :).

-Dustin
Rom 8:28
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top