Go Back  HTML Forums - Free Webmaster Forums and Help Forums > SERVER ADMINISTRATION > Linux Administration
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 08-28-2009, 04:59 PM
  #1
eventide
Veteran (Level 7)
 
eventide's Avatar
 
Join Date: Mar 2009
Location: Central Minnesota
Posts: 66
iTrader: (0)
eventide is an unknown quantity at this point
Question htaccess question

I'm helping someone with his web site and I ran across this code in the htaccess file in his root folder:

Code:
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1 [NC]
Can someone explain exactly what the heck this is supposed to be doing? What is "SCRIPT_FILENAME"? (I know it's a server variable, but WHAT is it? I know that !-d and !-f mean not a directory/file. But what does it mean how it's used here?

The rewrite rule is pretty much totally foriegn to me. I know that regex notation is used, but the second carat confuses me and I know the $1 refers to something from the condition, but since I don't understand the condition, then I'm not sure what should/would be there.

Obvioulsy I'm lost on this...
HELP!!!
__________________
f u dn rd ths u cn gt a gd jb n prgrmmng

Eventide Web Design
eventide is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 08-28-2009, 08:52 PM
  #2
darksidepuffin
#!/usr/bin/puffin
 
darksidepuffin's Avatar
 
Join Date: Jan 2001
Location: Dartmouth, Nova Scotia, Canada
Posts: 5,079
iTrader: (0)
darksidepuffin will become famous soon enoughdarksidepuffin will become famous soon enough
This seems a bit of an odd rule to me, but, to address your questions:

If I'm not mistaken, it's trying to check SCRIPT_FILENAME (the path to the current executing file) to see if it's a directory or a file, and if not, match the filename if it doesn't contain a dot, and redirect to the filename. In other words...it's an infinite loop, or seems to be.

Request: /file_does_not_exist -> rewrite to file_does_not_exist
Request: /file_does_not_exist_with_extension_or_contains_a_.dot -> do nothing
Request: /file_exists -> do nothing
Request: /this_is_a_directory -> do nothing
__________________
William Crooks, a.k.a. DarksidePuffin (facebook|Official HTMLForums Group)
Lead Developer
Subliminal Development
Proudly running: Kubuntu Gutsy Gibbon on: ASus K8N-DL
darksidepuffin is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 08-29-2009, 02:40 PM
  #3
eventide
Veteran (Level 7)
 
eventide's Avatar
 
Join Date: Mar 2009
Location: Central Minnesota
Posts: 66
iTrader: (0)
eventide is an unknown quantity at this point
I.e. it's okay to get rid of it...

Well, I commented it out anyway!


Thanks, darkside
__________________
f u dn rd ths u cn gt a gd jb n prgrmmng

Eventide Web Design
eventide is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart
 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 06:09 AM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.