Solved

uri string

Posted on 2012-03-25
3
370 Views
Last Modified: 2012-06-27
hello -

im trying to test if uri string = url {

do this ....

}

here is the code
<?php if ($_SERVER['REQUEST_URI'] == 'http://localhost/wasabiii.dev/index.php') { ?>
<a href="lang/de/index.php" title="German"  />Deutsch</a>

Open in new window


else do this
<?php } else {?>
<a href="../lang/de/index.php" title="German"  />Deutsch</a>
<?php }?>

Open in new window


the purpose of this logic is so that if its in the main domain it will be redirected to the correct path. same as if in a sub domain hence the ../

what it does not do is capture the url and perform the requested process.
0
Comment
Question by:only1wizard
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
designatedinitializer earned 500 total points
ID: 37763130
Notice that $_SERVER['REQUEST_URI'] gives you the URI that was given to the server in order to access that particular page. In this case, it can be several things, like:
'http://localhost/wasabiii.dev/index.php'
'/index.php'
'../index.php'

You can determine what's going on if you place this before your 'if' clause:
print_r($_SERVER);

Open in new window

This will show you all the information you need to solve your problem.
0
 

Author Comment

by:only1wizard
ID: 37763135
thanks will try that
0
 

Author Closing Comment

by:only1wizard
ID: 37763145
thanks for your help!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Read about why website design really matters in today's demanding market.
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This video teaches users how to migrate an existing Wordpress website to a new domain.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now