Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2006-05-06 22:27:58
- Sootah
- Member
- Registered: 2006-05-04
- Posts: 27
Can someone explain (decypher) the .htaccess file works?
I just setup a bunch of 301 redirects to the new addresses on a site I just converted to TextPattern and am curious what the rest of the contents of the .htaccess are doing. I know it’s setting up the MOD Rewrite for apache so the urls entered access the textpattern stuff, but I don’t get how it’s doing it.
How is the /non/existant/url getting passed to index.php? (I assume that’s what it’s getting passed to.)
<code>
#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#RewriteBase /relative/web/path/
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.+) – [PT,L]
RewriteRule ^(.*) index.php </IfModule>#php_value register_globals 0
</code>
By /non/existant/url I mean that say, /articles/category/title-of-article doesn’t exist in the literal sense. If I FTP in there’s no path like that.
Last edited by Sootah (2006-05-06 22:28:59)
Offline
Re: Can someone explain (decypher) the .htaccess file works?
The first three lines which are starting with a #
are inactive (commented out).
RewriteCond %{REQUEST_FILENAME} -f [OR]
If the Request does match a file that exists on the filesytem OR
RewriteCond %{REQUEST_FILENAME} -d
if the Request does match a directory that exist on the filesystem,
RewriteRule ^(.+) - [PT,L]
then do nothing, and ignore the rest of the rules below.
RewriteRule ^(.*) index.php
Let everything be handled by index.php.
(Or more verbose: If you’re still here, the request didn’t match a file or directory that exists. Well, then internally pass it to index.php. The request-uri won’t be changed and will be available within the PHP-script in $_Server['REQUEST_URI']
(usually).)
Offline
#3 2006-05-07 04:40:58
- Sootah
- Member
- Registered: 2006-05-04
- Posts: 27
Re: Can someone explain (decypher) the .htaccess file works?
Freakin sweet. Thank you.
Offline