alias51
alias51

Reputation: 8648

htaccess rewrite rule explanation

I have the following in my .htaccess file:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

Can someone succcinctly tell me what this actually does, or where I can find the list of variables?

Upvotes: 1

Views: 1292

Answers (1)

anubhava
anubhava

Reputation: 786011

In short this forward every request to index.php in current directory if request is not for a valid file, directory or link. It will pass URL in a query parameter url to index.php

So effectively a URO of /foobar gets forwarded (internally) to /index.php?url=foobar

Flags used are:

  • L - Last (inject rule again)
  • QSA - Query String Append

Reference: Apache mod_rewrite Introduction

Upvotes: 3

Related Questions