EllisLab text mark
Advanced Search
1 of 3
1
   
Super .htaccess file
Posted: 25 July 2008 12:53 PM   [ # 11 ]   [ Rating: 0 ]
Avatar
Joined: 2008-05-28
682 posts

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!

 Signature 

Bramme.net webdevelopment
If I had a nickel for every time someone told me that my idea for melting down coins to make a giant robotic parrot was a bad idea, I would have one kicka$$ giant robotic parrot.

 
Posted: 26 July 2008 03:01 AM   [ # 12 ]   [ Rating: 0 ]
Avatar
Joined: 2007-09-30
25 posts

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.

 
Posted: 26 July 2008 11:18 AM   [ # 13 ]   [ Rating: 0 ]
Joined: 2007-03-12
11 posts
sdbruder - 26 July 2008 07:01 AM

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.

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!

 
Posted: 29 July 2008 08:38 AM   [ # 14 ]   [ Rating: 0 ]
Avatar
Joined: 2008-07-29
1 posts

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

 
Posted: 29 July 2008 02:25 PM   [ # 15 ]   [ Rating: 0 ]
Avatar
Joined: 2008-05-28
682 posts
spl - 29 July 2008 12:38 PM

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

I’d generally avoid stuff like this. Only asking for trouble I think, though you could give it a whirl and see what happens.

 Signature 

Bramme.net webdevelopment
If I had a nickel for every time someone told me that my idea for melting down coins to make a giant robotic parrot was a bad idea, I would have one kicka$$ giant robotic parrot.

 
Posted: 01 August 2008 10:03 PM   [ # 16 ]   [ Rating: 0 ]
Joined: 2008-03-31
8 posts
Maxximus - 19 July 2008 07:16 PM

Okay, you might want to add:

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

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.

 
Posted: 04 August 2008 01:18 PM   [ # 17 ]   [ Rating: 0 ]
Avatar
Joined: 2008-07-16
411 posts
spl - 29 July 2008 12:38 PM

what about when controller have same name as directory?

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.

 Signature 

My Blog, C2D, PHP Videos, Résumé, Super .htaccess, Extra hooks, and MicroMVC

 
Posted: 07 August 2008 06:42 PM   [ # 18 ]   [ Rating: 0 ]
Avatar
Joined: 2004-01-08
23 posts
spl - 29 July 2008 12:38 PM

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

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

#    RewriteCond %{REQUEST_FILENAME} !-d
    
RewriteCond %{REQUEST_FILENAME} !-
 Signature 

twilightcoders
CIMyAdmin

 
Posted: 07 August 2008 06:53 PM   [ # 19 ]   [ Rating: 0 ]
Avatar
Joined: 2008-07-16
411 posts
Volte - 07 August 2008 10:42 PM
spl - 29 July 2008 12:38 PM

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

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

#    RewriteCond %{REQUEST_FILENAME} !-d
    
RewriteCond %{REQUEST_FILENAME} !-

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

 Signature 

My Blog, C2D, PHP Videos, Résumé, Super .htaccess, Extra hooks, and MicroMVC

 
Posted: 07 August 2008 11:01 PM   [ # 20 ]   [ Rating: 0 ]
Joined: 2008-08-07
6 posts

The default htaccess CI provided in the documentation works for me. I looked around and saw yours. Copied it verbatum and fixed up the path. Works fantastic :D

Thanks.

 
Posted: 25 August 2008 06:39 AM   [ # 21 ]   [ Rating: 0 ]
Avatar
Joined: 2008-04-06
142 posts

how can i do this?

i have site
http://www.site.com
which was always redirected to
http://www.site.com/shop

since google is not happy with redirection, i need to make it accessible through main site like this.

http://www.site.com loads http://www.site.com/shop without redirection
and,
i need to do this in another site redirect http://www.site.com/shop/... to www.site.com/...

thanks.

 Signature 

CodeFight CMS - based on CI 2.0 | Facebook | All CI CMS | twitter | CI | My Website

 
Posted: 25 August 2008 11:50 AM   [ # 22 ]   [ Rating: 0 ]
Avatar
Joined: 2008-07-16
411 posts

So are you looking for something like this?

# If the file/dir is NOT real go to index
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond 
%{REQUEST_FILENAME} !-d
RewriteRule 
^(.*)$ /shop/index.php/$1 [QSA,L] 

You can redirect from the index to a file (like index.php) in the same way you can forward site.com to site.com/shop/

 Signature 

My Blog, C2D, PHP Videos, Résumé, Super .htaccess, Extra hooks, and MicroMVC

 
Posted: 25 August 2008 01:06 PM   [ # 23 ]   [ Rating: 0 ]
Avatar
Joined: 2008-05-22
56 posts

Xeoncross - I don’t think that’s what he was looking for, I think he needs two different rules.

#1 - Try this (not tested):

RewriteCond %{REQUEST_URI} !shop [NC]
RewriteRule 
^(.*)$ shop/$1 [L] 

#2 - Try this (again, not tested but *should* work):

Redirect 301 / /shop 

OR:

Redirect 301 http://www.your-site.com/shop 

Check the differences between 301 and 302 codes, it’s important to choose the right one according to your needs.

- uptime

 Signature 

- uptime

 
Posted: 25 August 2008 01:13 PM   [ # 24 ]   [ Rating: 0 ]
Avatar
Joined: 2008-07-16
411 posts
uptime - 25 August 2008 05:06 PM

Since google is not happy with redirection, i need to make it accessible…
...without redirection

I didn’t recomend a 301 or any other type of redirect because he stated that he wants the whole thing hidden from google/users eyes. In the same way we hide the “index.php/” with a default .htaccess.

I vote that you check to see if the query string includes the “shop/” part - then remove it if it does. Then either way load site.com/shop/index.php/

 Signature 

My Blog, C2D, PHP Videos, Résumé, Super .htaccess, Extra hooks, and MicroMVC

 
Posted: 25 August 2008 01:30 PM   [ # 25 ]   [ Rating: 0 ]
Avatar
Joined: 2008-05-22
56 posts

That’s what I thought at the beginning… But check the following quote:

dbashyal - 25 August 2008 10:39 AM

how can i do this?
and,
i need to do this in another site redirect http://www.site.com/shop/... to www.site.com/...

I agree that it’s not smart to show the same content in both / and /shop - I’m sure Google won’t like it…

 Signature 

- uptime

 
1 of 3
1