www.webdeveloper.com
Results 1 to 5 of 5

Thread: [RESOLVED] header issue

  1. #1
    Join Date
    Oct 2007
    Posts
    154

    resolved [RESOLVED] header issue

    I want to remove the index.php file extension, but what i do below doesn't work.

    if($_SERVER['HTTP_REFERER']) == "www.domain.com/index.php")
    header("Location: www.domain.com");

    This brings me back to www.domain.com/index.php

    How can I fix this?

    Thanks

  2. #2
    Join Date
    Jun 2003
    Location
    here
    Posts
    4,551
    What? If you come from the index page send you back to the first page?

    I think it might be easier to just never use index.php in your code,
    Code:
    /
    works fine for that purpose.
    If you are using PHP please use the [PHP] and [/PHP] forum tags for highlighting...
    The same applies to HTML and the forums [HTML][/HTML] tags.

  3. #3
    Join Date
    Oct 2007
    Posts
    154
    I would like to avoid using index.php for my main page.

    But search engines pick up both http://www.domain.com and http://www.domain.com/index.php

    I want http://www.domain.com/index.php to go to http://www.domain.com

    but when i use header("Location: http://www.domain.com"); it doesn't take away the /index.php

  4. #4
    Join Date
    Jun 2003
    Location
    here
    Posts
    4,551
    PHP Code:
    if($_SERVER['REQUEST_URI'] == 'index.php'){
      
    header('Location: /');
      exit;
    }; 
    Try that.
    If you are using PHP please use the [PHP] and [/PHP] forum tags for highlighting...
    The same applies to HTML and the forums [HTML][/HTML] tags.

  5. #5
    Join Date
    Oct 2007
    Posts
    154
    Yes that worked, thanks!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles