Extracting from website URL....

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Mr Tech
Forum Contributor
Posts: 424
Joined: Tue Aug 10, 2004 3:08 am

Extracting from website URL....

Post by Mr Tech »

I'm creating a Mod_Rewrite script for a CMS i have created. This is the .htaccess... Same as WordPress:

Code: Select all

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
What I need to do is get the index.php file to extract the url so it can display the correct content...

So if the url was http://www.mydomain.com/dir/subdir/ I could use $var_array[1] and $var_array[2] to read the different directories in the url... This code used to work for me but it isn't anymore...

Code: Select all

$var_array = explode("/",$PATH_INFO);
Does anyone know what code I would replace $PATH_INFO with so I can read the url?

Hopefully I'm making sense....
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

look inside $_SERVER.
Post Reply