Need somebody with PHP knowlodge

Discussion in 'Programming' started by haddad287, Jun 29, 2012.

  1. #1
    Currently I got this in my .htaccess file to remove .php from the url's of my website

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.php -f
    RewriteRule ^(.*)$ $1.php
    Code (markup):
    So lets say I go to a webpage like www.mydomain.com/support, it will take me to support.php

    But if I go to a webpage like www.mydomain.com/support/ , it will give me a Error 500: Internal Server Error

    How come when I add a / at the end of the website, it gives me a 500 error?
     
    haddad287, Jun 29, 2012 IP
  2. Einheijar

    Einheijar Well-Known Member

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    3
    Trophy Points:
    165
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.php -f
    RewriteRule ^(.*)(\/)?$ $1.php
    
    Code (markup):
     
    Einheijar, Jun 29, 2012 IP
  3. maxking1234

    maxking1234 Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    The reason it does it is because by putting a / at the end you are saying it is a folder, so it looks for the folder called support and doesn't find it.
     
    maxking1234, Jun 29, 2012 IP
  4. haddad287

    haddad287 Member

    Messages:
    148
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #4
    That did not work

    So how do I fix this?
     
    haddad287, Jun 29, 2012 IP
  5. maxking1234

    maxking1234 Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #5
    The easy way is not to put the / after it, why do you need to?
     
    maxking1234, Jun 29, 2012 IP
  6. deepakkumarb

    deepakkumarb Active Member

    Messages:
    307
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    73
    As Seller:
    100% - 1
    As Buyer:
    100% - 0
    #6
    deepakkumarb, Jun 29, 2012 IP
  7. haddad287

    haddad287 Member

    Messages:
    148
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #7
    I tried those but the .net/support/ still gives me 500 error
     
    haddad287, Jun 29, 2012 IP
  8. easic

    easic Active Member

    Messages:
    37
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    70
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #8
    Hi haddad,

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.php -f
    RewriteRule ^([^\/]+)(\/)*$ $1.php
     
    easic, Jun 29, 2012 IP
  9. haddad287

    haddad287 Member

    Messages:
    148
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #9
    I tried that, it just took me to the 500 error page, and the link became

    mydomain.com/support/.php.php/.php/
     
    haddad287, Jun 29, 2012 IP
  10. easic

    easic Active Member

    Messages:
    37
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    70
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #10
    I tested here and it works fine...
     
    easic, Jun 29, 2012 IP