0
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond $1 !^(index\.php|images|robots\.txt)
    RewriteRule ^(.*)$ /index.php/$1 [L]

</IfModule>

can any body explain me how above htaccess rule works e.g. if I have URL http://mydomain/edituser so what php script will match with given URL

earlier I write different rules for each given URL but in above case how I know that witch php script get run please help me

2
  • Thank you @Joe I am new here and I do not know how to format text while asking question. thank again. Commented Sep 23, 2011 at 12:37
  • @Abhijeet - that's fine, this is a very community oriented site. One day you will fix another person's question! Commented Sep 23, 2011 at 14:31

3 Answers 3

1

That rewrite rule matches any request that does not match an existing file, and routes the request to to index.php using PATH_INFO

Sign up to request clarification or add additional context in comments.

Comments

1

Translation of the above code is like that:

RewriteEngine On: Activate the RewriteEngine if not already activated
RewriteCond %{REQUEST_FILENAME} !-f: If the requested file name is not a regular file
RewriteCond %{REQUEST_FILENAME} !-d: If the requested file name is not a regular directory
RewriteCond $1 !^(index\.php|images|robots\.txt): If the request is not the index.php, the images or robots.txt file
RewriteRule ^(.*)$ /index.php/$1 [L]: Send the request to index.php and stop ([L])

Comments

0

This looks as a part from WordPress. If the file doesn't exists (-f) and a directory also not exists (-d) and the request is not for index.php or images or robots.txt when call index.php with the path as a parameter.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.