The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

Grab end or url (like and use a var 4 index

  • # September 20, 2009 at 10:54 am


    I wanted to know if anyone new a way of grabbing the end of the url. What I would like is the normal "" then when you use a different url like "" 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?

    # September 22, 2009 at 8:22 am

    put this in a .htaccess file:

    RewriteEngine On

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

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

    and put this in the index.php:

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

    echo ‘

    echo '


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

    # September 22, 2009 at 8:25 am

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

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed