SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast Brian-X's Avatar
    Join Date
    Jun 2006
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question how can I hide the .html/.php/.asp extension in the address of my site ?

    One of my clients wants me to make all the file extensions in the address of all pages invisible(hidden) , can enybody tell me how I can do that using JS for esxample ?

    apreciate your help !
    my world is just 01010110, isn`t that enough ?

  2. #2
    Caveat surfer Buddy Bradley's Avatar
    Join Date
    May 2003
    Location
    Cambridge, UK
    Posts
    2,366
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can't do this with Javascript. Have a google for ".htaccess", which is a file that the Apache webserver uses to redirect requests. To remove filetypes, you would have a rule something like this, I guess:
    Code:
    RewriteRule ^/(.*)$ /$1.php [L]
    (or whatever file extension you are using)
    Last edited by Buddy Bradley; Oct 5, 2006 at 06:02.

  3. #3
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    why?

    I know clients are clients but seriously, people can find out what it's running on one way or the other.


  4. #4
    Caveat surfer Buddy Bradley's Avatar
    Join Date
    May 2003
    Location
    Cambridge, UK
    Posts
    2,366
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by gRoberts
    why?

    I know clients are clients but seriously, people can find out what it's running on one way or the other.
    You may want to do this so that your URLs are not tied to the underlying technology. If you use clean URLs, you can switch from PHP to ASP to JSP to ColdFusion; all you have to do is change the filetype in .htaccess (and make sure you use the same URL structure, of course).

  5. #5
    SitePoint Enthusiast Brian-X's Avatar
    Join Date
    Jun 2006
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the tip , oh and by the way my client thought that this hole .php thing would make the URL muck to complicated to be understood and he wants me to take the http:// out of it as well . Luckily I know how thatsa done now .
    my world is just 01010110, isn`t that enough ?

  6. #6
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    You can't take out the http:// as that is what identifies that it is a web page and not a ftp:// mailto: or other internet type. Since browsers are normally used primarily to display web pages most will usually assume http:// on the front of addresses if they are left off when entered into the address bar but this means that the browser adds it before passing the address for processing. If the address is being passed from somewhere that doesn't add the http:// for you then it will need to be included if you want it to work.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

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