Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Grab end or url (like domain.com/info) and use a var 4 index

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #26190
    bor003
    Member

    Hi,

    I wanted to know if anyone new a way of grabbing the end of the url. What I would like is the normal "domain.com/index.php" then when you use a different url like "domain.com/info" the info will become a variable for the index page.

    Does anyone know how to do this or a tutorial that will help with this type of thing?

    #64552
    Argeaux
    Participant

    put this in a .htaccess file:

    Code:
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*)$ index.php?url=$1 [L]

    and put this in the index.php:

    Code:
    //url rewrite
    $url = strip_tags($_GET[‘url’]);
    $url = explode(‘/’, $url);

    echo ‘

    ';
    print_r($url);
    echo '

    ‘;

    now all the stuff after the domainname is in the $url variable.

    #64553
    bor003
    Member

    Thanks so much! I will defiantly give this a try!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.