Question: **CODE :**

**.htaccess:**

```
RewriteEngine On  
RewriteRule    ^(.*)/*$    base.php?request=$1    [NC,L]  

```

**base.php**

```
<?php
    echo "this is base.php <br/> and Get Vaiables <br> ";
    print_r($_GET);
?>

```

*for the request:* 

```
localhost/blahblahproject/hello  

```

**EXPECTED RESULT:**

> 
> this is base.php  
> 
>  and Get Vaiables  
> 
>  Array ( [request] => hello )
> 
> 
> 

**Current RESULT:**

> 
> this is base.php  
> 
>  and Get Vaiables  
> 
>  Array ( [request] => base.php )
> 
> 
>

Answer: 
Change your .htaccess rule to this:

```
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/?$ /base.php?request=$1 [QSA,L] 

```
`.htaccess` only redirects url to your get parameter. To retrieve the url value, use `parse_url` or similar command.

I have a function like this to do the job:

```
/**
 * Sets current request url
 */
private function setUrl() {
    $path = parse_url( $_SERVER[ 'REQUEST_URI' ], PHP_URL_PATH );
    $pathTrimmed = trim( $path, '/' );
    $pathTokens = explode( '/', $pathTrimmed );

    if ( substr( $path, -1 ) !== '/' ) {
        array_pop( $pathTokens );
    }

    $url = end( $pathTokens );

    $this -> url = $url;
}

```