#1
  1. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Nobbies beach, Gold Coast. It's beautiful.
    Posts
    2,578
    Rep Power
    171

    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.
    First website
    http://www.webmoosh.com/website/celebrities
    [PHP_SELF] => /website/index.php/celebrities
    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
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,233
    Rep Power
    593
    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.
  4. #3
  5. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,692
    Rep Power
    6351
    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.
  6. #4
  7. Mad Scientist
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2007
    Location
    North Yorkshire, UK
    Posts
    3,660
    Rep Power
    4123
    Tried looking at _SERVER['REQUEST_URI'] ?

    might have more predictable results
    I said I didn't like ORM!!! <?php $this->model->update($this->request->resources[0])->set($this->request->getData())->getData('count'); ?>

    PDO vs mysql_* functions: Find a Migration Guide Here

    [ Xeneco - T'interweb Development ] - [ Are you a Help Vampire? ] - [ Read The manual! ] - [ W3 methods - GET, POST, etc ] - [ Web Design Hell ]
  8. #5
  9. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,754
    Rep Power
    9397
    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.
  10. #6
  11. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,301
    Rep Power
    7170
    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).
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo