Вопрос

I'm just starting out with Lithium, and I'm a total framework newbie, so I'm having a hard time understanding the paradigm at work here - trying to understand rewrite rules is useless to me because I don't know what they would be trying to accomplish.

I've broken up Lithium in a way that is different from how it comes installed, and I'm wondering if I need to change my htaccess, and in what way. I know what rewrite rules in .htaccess files "do," but I'd like to understand what their role is in the Lithium framework. What does their behavior allow Lithium to do?

Here's my best guess: The rules in / and /app effectively force any request down to the webroot directory, where it is picked up by the /app/webroot rules. The /app/webroot rules append the given url to "index.php?url=". So their purpose is to make /app/webroot the base directory (as far as the user can tell) and then throw the given URL into a "get" parameter so that it can be parsed from index.php. Does that sound about right? And if I've changed my file structure to

/foo     # was /app/webroot
/foo-app # was /app, no longer includes webroot dir

and I want / to present a blank page, then I can ignore the rewrite rules in /foo and /, and leave the one in /foo-app alone?

Это было полезно?

Решение

the .htaccess is effectively there to force everything into webroot for security purposes, mostly. So nobody can access anything outside webroot.

The other purpose of it, as you've figured that out is to have nice URLs. So foo/bar gets rewritten as: index.php?url=/foo/bar

If you plan to move webroot somewhere here, fix the paths and that should be it.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top