FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


.htaccess SEF urls





Fire Boar
Code:
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]


Joomla has this line, and that seems to be the only thing likely to be causing the magic SEF urls. How on earth did they manage this? More importantly, what does it do? Here's the full section:

Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]


It looks like it's using the HTTP_AUTHORIZATION environment variable somehow, but I'm not sure how they're changing the URLs or using them in PHP. Any insight into this and how I could use it myself would be great.

EDIT: Hehe. I answered my own question through a bit of experimenting, but I'm leaving this up for people in case they find it interesting.

The line that's actually doing the jazz is:

RewiteRule (.*) index.php

That simply redirects absolutely everything to index.php. Why is that so amazing? Because you can then use the $_SERVER['REQUEST_URI'] variable to get the page they were actually after, and display it through index.php. No need for hundreds of complicated rules, just one class to deal with it.
rvec
the sef rules are actually all the other rules besides that one Razz

the first couple are conditions in which case the rules should be used, the last 2 are the rules. You can read more about it by searching on 'htaccess rewrite'
Fire Boar
Yeah, I get that. Is the bottom one just a security thing then or something? Since it has no conditionals and matches .* it should work on all URLs, correct?
rvec
http://www.besthostratings.com/articles/http-auth-php-cgi.html
that explains that last line
Related topics
.htaccess tutorial
Custom error pages using .htaccess
Is it possible to make Mambo CMS searchable in Google?
Does frihost have mod_rewrite?
.htaccess instead of mod_rewrite
only .htaccess instead of mod_rewrite
Which CMS is Search Engine Friendly
(resolved)Help! I messed up my .htaccess(please close)
.htaccess file rename
.htaccess redirect?
PHP and .htaccess
Hide PHP file extension
301 redirection in PHP and .htaccess
SEO your Joomla website
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.