.htaccess

Discussion in 'Apache' started by mehbooba, Nov 8, 2006.

  1. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #21
    domain.com/.htaccess

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ articles/articles [L,QSA]

    is my only guess.
     
    Nintendo, Nov 8, 2006 IP
  2. mehbooba

    mehbooba Peon

    Messages:
    260
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #22
    wow..that worked... many thanks for your help (and to hacker as well)
     
    mehbooba, Nov 9, 2006 IP
  3. WhiteHatHacker

    WhiteHatHacker Peon

    Messages:
    21
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #23
    Perhaps this thread should be closed now, but anyway... Two notes:

    1) No offence, Nintendo, your efforts to make the world a better place are great :), but I could have told you, mehbooba, that rule. It simply redirects any requests for ANY non-existent files to articles/articles. This may work for you (indeed, my home-made CMS engine redirects all requests for files not under /_static/ to index.php) but be aware that you may have a lot more requests than necessary to the php file) creating excess overhead. Also - and I'm sure you're aware of this too - make sure you parse the request so that it doesn't contain anything except A-Za-z0-9_.+= whatever - NO QUOTATION MARKS etc. - to prevent a security risk through "MySQL injection".

    2) For any other people reading this thread: the way to get information about a request without the query string (i.e. "?article=something&page=10..." etc.) is to use environment variables. So long as the mod_rewrite rules are not sending a 301 redirect - [R=301] - the variable REQUEST_URI gives access to the ORIGINAL request, not the modified version. In PHP, the syntax is $_SERVER["REQUEST_URI"]

    Happy rewriting to you all!
     
    WhiteHatHacker, Nov 9, 2006 IP