htaccess rewriterule index.html
I'm using a PHP framework which redirect all URL to the index.php file using the following rule:
RewriteRule ^(.*)$ /index开发者_如何转开发.php/$1 [L]
However, I want to be able to use index.html IF ANY ONLY IF users hit the home page. For instance, if users hit http:// website.com it will render the index.html file. Any other URL will use index.php. Could someone help?
ThankS
^/(.+)$
Matches everything but the root.
However, either way this rewrite strategy is questionable. Sending absolutely everything to PHP — including robots.txt
, favicon.ico
, crossdomain.xml
, other random things a bot might speculatively request, and all the automated break-in attempts on odd paths that don't exist — is likely to hit performance hard.
(It's also a potential problem if the script doesn't reply 404 properly for non-existant paths: someone could use file-based domain authentication to take over Google Webmaster Tools for your account.)
I'd try to put some limitations on what kind of paths are allowed to match.
精彩评论