+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Oct 2012
    Posts
    33

    How can i hide the .extension file in url?

    hello,

    I want to hide the extension file in address bar.

    Example: www.aaa.com/index.php and it should be like this www.aaa.com/index

    Please let me know anyone waiting for ur response..

    This is my .htaccess file in website

    RewriteEngine on

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteCond %{REQUEST_FILENAME}\.php -f

    RewriteRule ^(.*)$ $1.php






    regards,
    simbu.
    Last edited by simbu; 11-14-2012 at 01:07 AM.

  2. #2
    Super Moderator
    Join Date
    Jul 2004
    Posts
    18,738
    One way:
    Code:
    Options +MultiViews
    See MultiViews in the Apache docs for more info on what that does.

  3. #3
    Member
    Join Date
    Oct 2012
    Posts
    33
    Quote Originally Posted by bradgrafelman View Post
    One way:
    Code:
    Options +MultiViews
    See MultiViews in the Apache docs for more info on what that does.
    Now there is no change in my url.I am getting with .php or .html extensions.

    Could somebody tell me whats the problem?



    regards,
    simbu.

  4. #4
    Senior Member traq's Avatar
    Join Date
    Jun 2011
    Location
    so.Cal
    Posts
    673
    Write the URL without the file extension.

    .htaccess can help find the file when you leave the extension off, but only the user can decide what to write in the address bar.

    Likewise, change all your links to omit the file extension.

  5. #5
    Senior Member
    Join Date
    Apr 2003
    Location
    LA
    Posts
    4,561
    If you type in a particular url and your server is configured to respond to that url without redirecting, then the url is going to stay unchanged.

    If you want a request to that url to redirect the user somewhere else, you'll need to either alter index.php to redirect the user:
    PHP Code:
    header("location index");
    exit; 
    Or you'll need to set up some appropriate mod_rewrite directive. Offhand, I don't know what that would look like.
    IMPORTANT: You need to stop using the mysql extension. Use mysqli or pdo instead.
    Write multiplayer games in AS3/PHP5 with FlashMOG 0.3.1
    Find out your worth with the MyPlan Salary Calculator

  6. #6
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    7,220
    You can also using Apache type directives (like ForceType) to force a file without an extension to be parsed as, say, PHP.
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

Thread Information

Users Browsing this Thread

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

     

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