Solved

uri string

Posted on 2012-03-25
3
378 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

739 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