Archive for October, 2008

6 comments

2008-10-29

 

Posted in:
programming.

.htaccess, document root and Zend Framework

It’s funny but I couldn’t find anyone having this issue. It certainly isn’t limited to Zend Framework, it affects everyone who doesn’t have access to apache configuration and wants to have document root in a deeper directory. Maybe I just can’t google very well.

Imagine a shared host. You can’t choose your document root, it’s firmly set to one particular directory. Now you want to install Zend Framework. Imagine you’d like to follow the standard directory structure (that means you more or less have these directories in your project: application (the application), library (zend and other libraries) and public (stuff accessible from the outside, images, css etc.)). Normally, you’d want to point your document root to the public directory, but when you can’t do that you can use .htaccess in the project directory to redirect everything to public.

RewriteEngine On
RewriteRule !\.(js|gif|jpg|png|css|txt)$ public/index.php [L]
RewriteRule ^(.*)$ public/$1 [L]

This was the first thing I wrote, and it works on certain servers. Other servers will kindly remind you that “Request exceeded the limit of 10 internal redirects due to probable configuration error.” Which kind of makes sense when you think about it. Makes me wonder how comes the above code actually worked on two different configurations.

Now here’s the code that works (and in my humble opinion it also should work, as opposed to the one above):

RewriteEngine On
RewriteRule !\.(js|gif|jpg|png|css|txt)$ public/index.php [L]
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ public/$1 [L]

And finally a disclaimer: I am not sure about the security implications. If someone knows more about possible security issues with this, please do leave a comment.

1 comment

2008-10-21

 

Posted in:
other.

How I Met Your Mother

I’ve never really watched any television series. Sure, I saw an episode or two of many various series, but it never quite felt worth spending more time on them. This summer I was shown 4 episodes of HIMYM.

I tried to resist for a while, because I consider television series to be a waste of time (and time is the most precious for me). But after few weeks I just gave up and started watching the series from the start. And even though I “wasted” about 24 hours of my life, I don’t regret it.

Also, my opinion of Tuesdays has increased dramatically since I started watching HIMYM. Today’s episode (S04E05 as they say, or “Shelter Island”, if you prefer the full name) was simply perfect. There was a little bit of everything, silly jokes, profound jokes, back references, sad moments, life lessons, you name it.

Happy Tuesday!

3 comments

2008-10-02

 

Posted in:
random thoughts.

Whatever

Such an amazing word! It can be used to express a myriad of different meanings, but they all have something in common — indifference. “Whatever” is possibly the most indifferent word in the world.

I’ve been searching for a Czech equivalent, but there simply isn’t anything similar. When you are asked whether you want chocolate or vanilla ice cream, you can say “I don’t care”, but saying “whatever” is way cooler. Unfortunately, in Czech language, we are stuck with “I don’t care”.

Whatever…