Welcome Guest, Not a member yet? Register   Sign In
My App initializes 3 times everything
#7

[eluser]WanWizard[/eluser]
@Jelmer,

I don't want to offend anyone by using the word "lazy". I'm (like you) not a native english speaker. I'm just a perfectionist, and not easily satisfied with a "more generic" solution if a better fitting one exists.

I use this .htaccess for all my projects, which doesn't use the generic file or directory check. If I have to exclude more from rewriting, I prefer adding a RewriteCond manually then rely on something generic, so I'm always in control of the magic mod_rewrite performs.

Code:
<IfModule mod_rewrite.c>

    # ATTENTION: if this .htaccess doesn't work, check if rewrites
    # are allowed in httpd.conf. You need to specify:
    # <Directory "my-website-directory-here">
    #     Options +FollowSymLinks
    #     AllowOverride FileInfo
    # </Directory>
    # or have these options defined globally in your httpd.conf file
    # to allow a .htaccess with rewrite rules to work!

    # activate URL rewriting
    RewriteEngine On

    # if the application is installed in a sub-directory of the document
    # root, modify the path below accordingly
    RewriteBase /

    # nasty hack to capture ruined URI's by a mod_rewrite bug.
    #
    # You need these two lines when you use mod_vhost_alias, and this
    # .htaccess file generates a "500 internal server error".
    # In the rule below, replace --DOCROOT-- by your full docroot path,
    # without a leading slash, but with a trailing slash!
    # (i.e 'path/to/my/docroot/', without quotes offcourse)
    #
#    RewriteCond $1 index\.php/$
#    RewriteRule ^--DOCROOT--(.*)$ /$1 [S=1]

    # Do not rewrite links to our documentation
    # You should remove this on production sites!
    RewriteCond $1 !^docs

    # do not rewrite links to website assets
    RewriteCond $1 !^assets

    # do not rewrite for our php files in the document root,
    # or for robots.txt requests
    RewriteCond $1 !^(index\.php|cron\.php|file\.php|ajax\.php|robot\.txt)

    # but rewrite everything else
    RewriteRule ^(.*)$ index.php/$1 [L]

</IfModule>

<IfModule !mod_rewrite.c>
    # If we    don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php

</IfModule>


Messages In This Thread
My App initializes 3 times everything - by El Forum - 08-06-2010, 05:34 AM
My App initializes 3 times everything - by El Forum - 08-06-2010, 06:33 AM
My App initializes 3 times everything - by El Forum - 08-06-2010, 08:59 AM
My App initializes 3 times everything - by El Forum - 08-06-2010, 09:51 AM
My App initializes 3 times everything - by El Forum - 08-06-2010, 12:26 PM
My App initializes 3 times everything - by El Forum - 08-06-2010, 07:01 PM
My App initializes 3 times everything - by El Forum - 08-07-2010, 01:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB