PHP Classes

htaccess

Recommend this page to a friend!

      HTAccess mod_rewrite  >  All threads  >  htaccess  >  (Un) Subscribe thread alerts  
Subject:htaccess
Summary:use of htaccess
Messages:3
Author:rohinim
Date:2007-02-22 06:15:12
Update:2010-08-31 23:17:25
 

  1. htaccess   Reply   Report abuse  
Picture of rohinim rohinim - 2007-02-22 06:15:12
how do i use this class file in my server

  2. Re: htaccess   Reply   Report abuse  
Picture of Vladimir S. Bredihin Vladimir S. Bredihin - 2007-03-24 07:56:47 - In reply to message 1 from rohinim
1. Rewrite all requests, on your script with included htaccess.class.php
Example:
.htaccess
RewriteEngine On
RewriteRule ^([^.]+)$ index.php

2. In your script use $_SERVER['REQUEST_URI'] for call $htaccess->execute ();
Example:
$vdir = $_SERVER['REQUEST_URI'];

$htaccess = new HTAccess ($_GET);

$htaccess->setLine ('RewriteBase /');
$htaccess->setLine ('RewriteRule ^(test1)[/]?$ ?action=$1 [L]');
$htaccess->setLine ('RewriteRule ^(test1/2)[/]?$ ?action=$1&page=2 [L]');

$htaccess->execute ($vdir);

3. Get result works.
Example:
print_r($_GET);

  3. Re: htaccess   Reply   Report abuse  
Picture of MyNem MyNem - 2010-08-31 23:17:25 - In reply to message 2 from Vladimir S. Bredihin
It not works for me.
Just get an simple Output "'Array ( )'" when im calling "http://dev/site/test1/2" on my browser.

Any suggestions?
Thanks a lot fpr the Script!