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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mod_rewrite for security

Status
Not open for further replies.

cleaner416

Programmer
Feb 5, 2002
42
US
First off, I am a mod_rewrite newbie...apologies in advance.

Essentially I want to use mod_rewrite to hide .php extensions. For example, I want to redirect internally to foo.php. I need the rule constructed so that /foobar/ will still go to /foobar/, to keep the directories intact. I also want to make sure the whole scheme keeps working with GET and POST variables, cookies and sessions. I need to do this within an .htaccess file.

I can't seem to get the syntax right for this one...any help would be greatly appreciated.

Thanks in advance!
 
Maybe :

RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^/(.*)$ [proxy]


The Cond rule should check 'Is this request + .php a file?'
If it passes you can do a proxy to yourself to get the file.

Possibly, I did not test this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top