Apache Server configuration support - [newbie] Making sense of a .htaccess

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > January 2007 > [newbie] Making sense of a .htaccess





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author [newbie] Making sense of a .htaccess
Vincent Delporte

2007-01-25, 1:39 am

Hello

When working on my laptop, I'd like to use a lighter alternative to
Apache that is Abyss X1 to write web apps using the Code Igniter PHP
framework. Problem is, to present clean URLs, Code Igniter uses
mod_rewrite and .htaccess... which Abyss doesn't support.

I googled for information on mod_rewrite, but I'm stuck with the
second condition below :-/

So I need to understand what the .htaccess sample given in the Code
Igniter documentation means before trying to rewrite it to work with
Abyss' URL Rewriting module.

Here's the .htaccess that works when I upload the app on a shared host
that runs Apache:

----------
RewriteEngine on
RewriteRule ^$ index.php [L]
RewriteCond $1 !^(index\.php|assets|search)
RewriteRule ^(.*)$ index.php/$1 [L]
----------

1. Does the first line mean that if the URL is empty for that part of
the URL (eg. http://localhost/igniter/), it should append index.php
(to turn into http://localhost/igniter/index.php)?

2. In the RewriteCond line, what does $1 stand for? I haven't found
information on this type of variable. Is it somehow related to a $1
reference in regexes?

Thanks!
Davide Bianchi

2007-01-25, 7:21 am

On 2007-01-25, Vincent Delporte <justask@acme.com> wrote:
> I googled for information on mod_rewrite, but I'm stuck with the
> second condition below :-/
>
> RewriteRule ^$ index.php [L]


When a URL without a page is asked, use 'index.php', this is the
equivalent of saying "DirectoryIndex index.php index.html", if no
page is specifically requested, pick index.php first.

> RewriteCond $1 !^(index\.php|assets|search)


If is not 'index.php or assets or search' then

> RewriteRule ^(.*)$ index.php/$1 [L]


Ask for index.php/<wathever was requested>

> 1. Does the first line mean that if the URL is empty for that part of
> the URL (eg. http://localhost/igniter/), it should append index.php
> (to turn into http://localhost/igniter/index.php)?


Yep.

> 2. In the RewriteCond line, what does $1 stand for?


The bits in the parenthesis in the url, so basically the whole URL.

Davide

--
If this is non-responsive to your question try using English, normal
punctuation and capitalization rather than silly abbreviations.
Language barriers are understandable, careless obfuscation and useless
abbreviation is not.
Vincent Delporte

2007-01-26, 7:23 am

On Thu, 25 Jan 2007 08:58:47 +0100, Davide Bianchi
<davideyeahsure@onlyforfun.net> wrote:
>
>The bits in the parenthesis in the url, so basically the whole URL.


OK. So Apache first saves the stuff between brackets into $1, and then
performs the test.

Thanks!
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2009 webservertalk.com