Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite troubles

         

decola

3:39 pm on Feb 2, 2006 (gmt 0)

10+ Year Member



Hi all!
My troubles are about mod_rewrite. I'm using Debian and Apache2 (by dotdeb)

I want that if Web browser asks for
[localhost...]
Apache returns the file
main.htm

Below there are lasts lines of my apache2.conf:
# NameVirtualHost *
# Include the virtual host configurations:
# Include /etc/apache2/sites-enabled/[^.#]*
DocumentRoot /var/www
RewriteEngine on
RewriteRule ^index\.php$ /main.htm

The module mod_rewrite is loaded (I'm sure on it) but if the browser asks for
[localhost...]
Apache returns the file index.php... It seems RewriteRule doesn't work!

What's the matter?

Thanks in advance.

extras

5:44 pm on Feb 2, 2006 (gmt 0)

10+ Year Member



You need to match against full path.

RewriteRule ^/index\.php$ /main.htm

When you use RewriteRules in per-directory context, such as .htaccess,
<directory ...>, <Location ....>, the directory part up to the slash is removed before matching agaist Regex.
But not in the other contexts.

decola

10:15 pm on Feb 2, 2006 (gmt 0)

10+ Year Member



It Works!

Thanks, you're the best!