You are not logged in.

#1 2007-11-17 13:15:23

Gruntz
Member
From: Haskovo, Bulgaria
Registered: 2007-08-31
Posts: 252

Apache, mod_rewrite, do not work.

Hello,

I have problem with apache`s mod_rewrite.

I have the following in my httpd.conf file:
LoadModule rewrite_module            modules/mod_rewrite.so

This is in my .htaccess:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule    ^([0-9a-zA-Z/&_=\-]+)$ /?path=$1 [PT]
</IfModule>

I have virtual hosts on my machine, and here is how I had set the virtual host.
<VirtualHost *:80>
    ServerAdmin darkmill@gmail.com
    DocumentRoot "/home/www/htdocs/test"
    ServerName test
    #<IfModule mod_rewrite.c>
    #    RewriteEngine On
    #    RewriteRule ^([0-9a-zA-Z/&_=\-]+)$ /?path=$1 [PT]
    #</IfModule>
    <Directory "/home/www/htdocs/test">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    ErrorLog /var/log/httpd/test.log
    CustomLog /var/log/httpd/test.log common
</VirtualHost>

I had tried with mod_rewrite, mod_rewrite.c, mod_rewrite.so in the IfModule section, but nothing works.
I had tried to uncomment the IfModule in the VIrtualHost section, and to remove the .htaccess, but is not working.

This is how I am testing, if the mod_rewrite is working.
<?php

class index {
   
    var $parameters;

    function index() {
        $this->parameters = @explode('/', $_GET['path']);
    }
   
    function parameter($number){
        return $this->parameters[$number-1];
    }

}

    $page = new index();
    $prom1 = $page->parameter(1);
    $prom2 = $page->parameter(2);
    $prom3 = $page->parameter(3);
    $prom4 = $page->parameter(4);
    echo $prom1.'  '.$prom2.'  '.$prom3.' '.$prom4.'<p>';
    echo ">>>".$_GET['path']."<<<";

?>

Can someone help me with setting mod_rewrite, please.

Apache 2.2.6
PHP 6.2.5 with Suhosin-Patch 0.9.6.2
(all from repo)

Regards.

Offline

#2 2007-11-18 20:40:33

Gruntz
Member
From: Haskovo, Bulgaria
Registered: 2007-08-31
Posts: 252

Re: Apache, mod_rewrite, do not work.

The problem is solved. The mod_rewrite is working. I was just testing on file, that my rewrite rule was unable to work. Thank you all.

Offline

Board footer

Powered by FluxBB