Welcome Guest, Not a member yet? Register   Sign In
Super .htaccess file
#11

[eluser]RaZoR LeGaCy[/eluser]
[quote author="Maxximus" date="1216509387"]Okay, you might want to add:
Code:
<ifModule mod_expires.c>
  <filesmatch "\.(ico|flv|jpg|jpeg|png|gif|js|css|swf)$">
       ExpiresActive on
       ExpiresDefault "access plus 1 year"
   </filesmatch>
</ifModule>

<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/xhtml text/html text/plain text/xml text/javascript application/x-javascript text/css
</IfModule>

FileETag none

mod_expires adds an expires tag to the mentioned files, so it will be user-cached for quite some time (one year to be exact Wink).
mod_deflate will use deflate (gzip-like) for the mentioned types, even you did not set it up in PHP or CI. Really fast and safe way, and your JS/CSS will be gzipped (deflated) as a bonus.

FileETag is useless according to Yahoo (not true), but the mod_expires will make sure user-caching is used.

The above will make YSlow very happy (and actually will help lowering your traffic a lot), provided that you will enable these modules in your Apache config of course.[/quote]

This is great but I have a prob, I updated a js file and now it keeps showing the old js. LoL
#12

[eluser]Bramme[/eluser]
Clearing cache should do the trick for you I think/hope. Try hitting ctrl+f5 if you're on Firefox. (or was it ctrl+r ?)


The .htaccess file works fine for me now. So I'm happy!
#13

[eluser]sdbruder[/eluser]
clearing the browser cache will do it, *for your client*.

We use aggressive caching with ExpiresDefault "access plus 1 year", but to circumvent that same agressive caching we use a global 'serial number' in all urls that mention cacheable files (images, js, css, etcetera), and part of our build process (Makefile) auto-updates it when some of that files changed, so /img/somefile.127.jpg got changed to /img/somefile.128.jpg in all generated html, and that some rewrite rules as

RewriteRule (.*)\.[0-9]+\.js $1.js
RewriteRule (.*)\.[0-9]+\.css $1.css
RewriteRule (.*)\.[0-9]+\.html $1.html

permits that none of our files need to be renamed.
#14

[eluser]Philip Ramirez[/eluser]
[quote author="sdbruder" date="1217070074"]clearing the browser cache will do it, *for your client*.

We use aggressive caching with ExpiresDefault "access plus 1 year", but to circumvent that same agressive caching we use a global 'serial number' in all urls that mention cacheable files (images, js, css, etcetera), and part of our build process (Makefile) auto-updates it when some of that files changed, so /img/somefile.127.jpg got changed to /img/somefile.128.jpg in all generated html, and that some rewrite rules as

RewriteRule (.*)\.[0-9]+\.js $1.js
RewriteRule (.*)\.[0-9]+\.css $1.css
RewriteRule (.*)\.[0-9]+\.html $1.html

permits that none of our files need to be renamed.[/quote]

Using something like main.css?v=123456560823 also handles that problem.

EDIT: apparently using query strings only works with IE and FF. So, sdbruder's way is def. the safest way!
#15

[eluser]Unknown[/eluser]
what about when controller have same name as directory?

is any way to get work something like this:

example.com/con - calls con controller
example.com/con/file.jpg - shows image
#16

[eluser]Bramme[/eluser]
[quote author="spl" date="1217349538"]what about when controller have same name as directory?

is any way to get work something like this:

example.com/con - calls con controller
example.com/con/file.jpg - shows image[/quote]I'd generally avoid stuff like this. Only asking for trouble I think, though you could give it a whirl and see what happens.
#17

[eluser]Macros[/eluser]
[quote author="Maxximus" date="1216509387"]Okay, you might want to add:
Code:
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/xhtml text/html text/plain text/xml text/javascript application/x-javascript text/css
</IfModule>
[/quote]
Might want to add application/javascript in there as well, my local install of Apache 2.2.9 returned a javascript file with that type.
#18

[eluser]Xeoncross[/eluser]
[quote author="spl" date="1217349538"]what about when controller have same name as directory?[/quote]

If the Dir DOES NOT exist - then the controller is called. So if you have a dir the same name as a controller - that controller will never be called. But this is the same problem with all .htaccess files anyway.

Like Bramme said, "I’d generally avoid stuff like this". It's the same thing as having two classes/functions called the same thing.
#19

[eluser]Volte[/eluser]
[quote author="spl" date="1217349538"]what about when controller have same name as directory?

is any way to get work something like this:

example.com/con - calls con controller
example.com/con/file.jpg - shows image[/quote]

Just turn off directory listing and it should fall through to your controller.

Code:
#    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
#20

[eluser]Xeoncross[/eluser]
[quote author="Volte" date="1218163370"][quote author="spl" date="1217349538"]what about when controller have same name as directory?

is any way to get work something like this:

example.com/con - calls con controller
example.com/con/file.jpg - shows image[/quote]

Just turn off directory listing and it should fall through to your controller.

Code:
#    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
[/quote]

You don't need to do this. The RewriteCONDITION is if NOT a REAL FILE (which example.com/con/file.jpg is) THEN pass to index.php




Theme © iAndrew 2016 - Forum software by © MyBB