Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
  1. #1
    Senior Member tekp's Avatar
    Join Date
    Jan 2004
    Location
    A small village near a small city near a small cit
    Posts
    918
    Member #
    4667
    Liked
    1 times
    Helloooo

    Can you use .htaccess files to strip the index.php text from any URL the user requests?

    so site.com/index.php would become site.com/
    tekp :cheeky: tekponline.com

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Do you mean to alter the address in the address bar?

    What I mean is, lets say a user is viewing index.php and they click a link to about.php

    When about.php loads you want the address bar to remian as domain.com rather than domain.com/about.php ?

  4. #3
    Senior Member tekp's Avatar
    Join Date
    Jan 2004
    Location
    A small village near a small city near a small cit
    Posts
    918
    Member #
    4667
    Liked
    1 times
    No, just if it's "index.php"

    So

    domain.com/index.php => domain.com/
    domain.com/directory/directory/index.php => domain.com/directory/directory/
    domain.com/notindex.php => domain.com/notindex.php
    domain.com/directory/directory/notindex.php => domain.com/directory/directory/notindex.php

    The last two being unchanged because they don't have "index.php" at the end
    tekp :cheeky: tekponline.com

  5. #4
    Senior Member raspberryh's Avatar
    Join Date
    Aug 2004
    Location
    Erie, PA
    Posts
    882
    Member #
    7208
    Liked
    1 times
    I'm not sure but I wonder if you could use a redirect?

    RedirectMatch 301 (.*)\index.html$ http://www.example.com$1

    ...but that would only work for index.html, not .php too, so maybe you could do this?

    RedirectMatch 301 (.*)\index.(.*)$ http://www.example.com$1

    ...I'm not entirely sure about the syntax and everything... but you can try it...

    ps: I used this page for reference.
    choosy developers choose gif!
    website | paintings | blog

  6. #5
    Senior Member tekp's Avatar
    Join Date
    Jan 2004
    Location
    A small village near a small city near a small cit
    Posts
    918
    Member #
    4667
    Liked
    1 times
    Okay thanks!

    I shall give it a try ^-^
    tekp :cheeky: tekponline.com

  7. #6
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    It is technically possible a variety of ways, but I'm not understanding why you'd want to do it.

    mod_rewrite won't be effective as it simply modifies the effective request that PHP receives. The URL itself doesn't change from what the user provided.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  8. #7
    Senior Member tekp's Avatar
    Join Date
    Jan 2004
    Location
    A small village near a small city near a small cit
    Posts
    918
    Member #
    4667
    Liked
    1 times
    I want to do it because "www.domain.com/section/" looks better, is easier to remember and is cleaner than "www.domain.com/section/index.php"... it just looks friendlier and simpler

    Can you suggest one of these methods?
    tekp :cheeky: tekponline.com

  9. #8
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    I would go with raspberryh's method; I prefer fixes that occur as early in the page load as possible, and hers will redirect before PHP even gets invoked. I don't know if the syntax is correct either, and keep in mind it's for Apache only, not IIS or other servers.

    But instead of all of that, I would just create the site and post links elsewhere that simply don't have index.php to begin with. That way, there won't be any links and the issue won't exist.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  10. #9
    Senior Member tekp's Avatar
    Join Date
    Jan 2004
    Location
    A small village near a small city near a small cit
    Posts
    918
    Member #
    4667
    Liked
    1 times
    Yeah but then when you're in the process of filling out a form, and you hit submit and the form is going to $_SERVER['PHP_SELF'] it puts index.php in...

    Or... I could just str_replace("index.php","",$self) couldn't I? Ahh! that's easier.. but thank you all the same ^-^ I'll have a mess around with that

    ps. why am I online on Christmas Day it sucks as you get older sigh!
    tekp :cheeky: tekponline.com

  11. #10
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    I'm not sure.. as filburt1 suggested, if you have all the links point to the folder and not folder/index.php that would work.

    So, if your form action points to a folder, the form will submit to folder/index.php


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 03:12 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com