www.webdeveloper.com
Results 1 to 4 of 4

Thread: hiding the ".php"

  1. #1
    Join Date
    Jun 2011
    Posts
    29

    hiding the ".php"

    im using this code to hide the .php extention but it does not work..

    Code:
    # Replace ".php" by ""
    #
    RewriteCond %{REQUEST_URI} !/$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME}\.php -f
    RewriteRule ^(.*)$ $1.php [L]
    any suggestions? why doesnt it work?

    i want to mention that the root folder of my website where the index.php and everything else is, is the httpdocs and not the public_html
    does this make any difference?
    Last edited by telisjok; 07-09-2012 at 07:58 PM. Reason: making the resolve easier

  2. #2
    Join Date
    Mar 2012
    Posts
    1,240
    1. Why are you trying to hide the .php extension?

    2. Why is your site in httpdocs instead of public_html?

    3. Why specify index.php in the first place? It should work without. If it doesn't, see 2 above...

  3. #3
    Join Date
    Jun 2011
    Posts
    29
    jedaisoul thank you but 3 questions doesnt answer my question..

    i want to hide .php because of curiosity.
    the server i bought for 2 years doesnt include any public_html folder..
    and i didnt understand ur 3rd question..

  4. #4
    Join Date
    Dec 2005
    Posts
    2,984
    Quote Originally Posted by jedaisoul View Post
    1. Why are you trying to hide the .php extension?

    2. Why is your site in httpdocs instead of public_html?

    3. Why specify index.php in the first place? It should work without. If it doesn't, see 2 above...
    What does that have anything to do with the original question?

    To the OP,

    (1) are you sure you have mod_rewrite turned on on your server? (Also, where's the RewriteEngine On line in your .htaccess file?)


    (2) Your second RewriteCond is saying if the requested file is not a file (by virtue of !-f), I think you meant to say if the requested file is not a directory by using !-d).
    I've switched careers...
    I'm NO LONGER a scientist,
    but now a web developer...
    awesome.

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