The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> PHP Development
|
How can I get $_SERVER['PHP_SELF'] to show what I want?
Discuss How can I get $_SERVER['PHP_SELF'] to show what I want? in the PHP Development forum on Dev Shed. How can I get $_SERVER['PHP_SELF'] to show what I want? PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

December 17th, 2012, 04:52 AM
|
 |
A Change of Season
|
|
|
|
|
How can I get $_SERVER['PHP_SELF'] to show what I want?
Hello;
I have problems with $_SERVER['PHP_SELF']. It shows 2 different things on 2 servers! I understand it might be a server setting. Quote: First website
http://www.webmoosh.com/website/celebrities
[PHP_SELF] => /website/index.php/celebrities | Quote: Secondwebsite
http://nickdavis.com.au/sincity/website/celebrities
[PHP_SELF] => /sincity/website/index.php | This is my htaccess:
Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
How can I get the second website to behave like first website?Thank you
|

December 17th, 2012, 07:09 AM
|
|
|
|
I don't think you can. The URL you generate, I believe, is technically invalid so how the httpd server interprets it is unpredictable. A URL is a path to a resource so unless index.php is a directory I don't know why it works at all. Perhaps if you explain what you are trying to accomplish with that odd URL we can be of more help.
__________________
There are 10 kinds of people in the world. Those that understand binary and those that don't.
|

December 17th, 2012, 09:15 AM
|
 |
Likely to be eaten by a grue.
|
|
Join Date: Oct 2006
Location: Pennsylvania, USA
|
|
|
Do both of these servers rewrite the same way?
__________________
HEY! YOU! Read the New User Guide and Forum Rules
"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin
"The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002
Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
|

December 17th, 2012, 10:11 AM
|
 |
Square Peg in a Round Hole
|
|
Join Date: Oct 2007
Location: North Yorkshire, UK
|
|
|
Tried looking at _SERVER['REQUEST_URI'] ?
might have more predictable results
|

December 17th, 2012, 11:55 AM
|
 |
Still alive
|
|
Join Date: Mar 2007
Location: Washington, USA
|
|
Quote: | Originally Posted by ManiacDan Do both of these servers rewrite the same way? |
On that note, do both servers have PHP installed the same way? Like Apache module versus (Fast)CGI.
|

December 17th, 2012, 08:17 PM
|
 |
Lost in code
|
|
|
|
|
If you're using the value for routing, use REQUEST_URI as previously suggested. If you're using it for some other purpose, explain that. There's probably and easier way to do what you want (besides changing your server setup).
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|