Solved

uri string

Posted on 2012-03-25
3
372 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Session timeout 5 13
PHP: concatenate query 12 30
Problem sending file attachments 8 22
remove background quote mark from widget 6 13
Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

932 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

17 Experts available now in Live!

Get 1:1 Help Now