开发者

htaccess help needed

开发者 https://www.devze.com 2022-12-19 08:33 出处:网络
i\'m doing maintenance work on a cms and have found the following htaccess file: <IfModule mod_rewrite.c>

i'm doing maintenance work on a cms and have found the following htaccess file:

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
#RewriteBase /


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

i'm having trouble understanding it. the reason a went looking for the htaccess file is this: i placed some code in index.php (right now just printing some string to a file but eventually will do banner cycling) and i've noticed the string gets printed a few times when i load index.php. could that have some connection to t开发者_如何学Che htaccess file?

thanx in advance for any input.


This simply checks whether a file exists (as a file -f, or directory -d). If it does not, it takes the address and passes it to index.php.

For instance if you ask for:

www.mysite.com/badfile.html

You will get:

www.mysite.com/index.php/badfile.html

This should have no effect on how the code in index.php runs. This only affects what happens when non-existent files and directories are requested.


Request is for a file on the webserver, denies access to index.php

RewriteCond %{REQUEST_FILENAME} !-f

Request is for a physical directory on the webserver, denies access to index.php

RewriteCond %{REQUEST_FILENAME} !-d 

Any other than the above, redirects to index.php

RewriteRule ^(.*)$ index.php/$1 [L]
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号