Abhijeet
Abhijeet

Reputation: 83

How to resolve following htaccess code

<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

Upvotes: 0

Views: 80

Answers (3)

KodeFor.Me
KodeFor.Me

Reputation: 13511

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])

Upvotes: 1

iwg
iwg

Reputation: 528

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.

Upvotes: 0

JohnD
JohnD

Reputation: 4002

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

Upvotes: 1

Related Questions