Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

RewriteRule (.*) index.php

Can you explain this?

share|improve this question

migrated from stackoverflow.com Feb 11 '10 at 8:24

This question came from our site for professional and enthusiast programmers.

3 Answers 3

up vote 1 down vote accepted

This rule matches requests to all possible URL paths and rewrites them to index.php.

share|improve this answer
    
Hi Gumbo. Thanks for the answer. Can you also tell me what is this? RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] –  Vivek Chandraprakash Feb 9 '10 at 18:41
    
@Vivek Chandraprakash: The E flag sets an environment variable. In this case the value of the HTTP header field Authorization is assigned to the environment variable HTTP_AUTHORIZATION. –  Gumbo Feb 9 '10 at 19:10

This points any web address given to index.php. The first argument is a regular expression (look it up if you don't know) and the second is of course the page to redirect to. Note that the redirect is on the server side and so isn't visible to the outside user, and this is therefore how websites make their addresses easier to read.

share|improve this answer
    
thanks. can you tell me what this means? RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] –  Vivek Chandraprakash Feb 9 '10 at 18:46
    
This will explain it: besthostratings.com/articles/http-auth-php-cgi.html –  Stephen Feb 9 '10 at 18:48

The very first result on google for "RewriteRule" is this. It very clearly explains the syntax.

(.*) is a regular expression which matches all incoming requests. It's basically saying any request that comes in, behave as if the user requested index.php

share|improve this answer
    
thanks for the reply. can you tell me what thsi means? RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] –  Vivek Chandraprakash Feb 9 '10 at 18:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.