Forum Moderators: coopster
I'm develeoping the structure for a site, and thought I needed to use a complex RewriteRule to keep the urls clean [google.com].
After reading a lot (great work jdMorgan, andreasfriedrich et al), I threw together the RewriteRule. Happy Days.
Then I came across some rambling by killroy ;-], going on about how variables in the url are 'abused', and that more often than not pages can be delivered using PAGE_PATH.
Fine, I think I get how it works, but can anyone fill me in on why and when I should be using PAGE_PATH, and which method is faster, the above or RewriteRules?
I am building a site where you can drill down thru a topic, ultimately ariving at a page that resides in a table in a db (like a directory, I suppose)... for example:
What is that? I did a Google search and came across some template systems and classes that use it, but I can't find it in the PHP or Apache docs.
Also, why does your rewrite rule need to be complex? It can be very simple? For example, I just do:
RewriteBase /path_beyond_root/
RewriteRule ^(.*)index.php$ - [L]
RewriteRule!(.*)\.(gif¦jpg¦png¦css¦js¦doc)$ /path_beyond_root/index.php [L]
Then I just parse it in index.php. It works for me.
In any case, without actually know what you're talking about, I would say that using Rewrite will be extremely fast on Apache and, as long as mod_rewrite is running, it should work in all cases.
Tom
Where did I get that from?
I meant PATH_INFO.
Whew. I wonder how many people came here and said '?huh?' Thanks Tom.
I just use
RewriteEngine on
RewriteRule ^(.*)/$ template.php/$1 [L]
and then basically do what is indicated in that thread. It works great, and keeps thing real simple.