Removing .php for one file only in htaccess

Discussion in 'Apache' started by misohoni, Jun 11, 2014.

  1. #1
    I'd like to change /comp.php to /comp but I have only found articles on how to remove .php completely and I don't want to do that, only want to do it for this one file.
     
    Solved! View solution.
    misohoni, Jun 11, 2014 IP
  2. #2
    Use This code in your .htaccess file and let me know if it works
    
    RewriteEngine On
    RewriteRule ^comp/?$ comp.php [NC]
    
    Code (markup):
     
    xXxpert, Jun 11, 2014 IP
    misohoni likes this.
  3. misohoni

    misohoni Notable Member

    Messages:
    1,717
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    200
    #3
    Thanks how could I make it a permanent redirect?
     
    misohoni, Jun 11, 2014 IP
  4. xXxpert

    xXxpert Well-Known Member

    Messages:
    604
    Likes Received:
    34
    Best Answers:
    9
    Trophy Points:
    165
    Digital Goods:
    7
    #4
    Why you want to make it a "Redirect"??
    Redirection is for moving user from 1 URL to Another URL using htaccess
     
    xXxpert, Jun 11, 2014 IP
  5. misohoni

    misohoni Notable Member

    Messages:
    1,717
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    200
    #5
    I meant in terms of if someone typed in /comp.php it should take them to /comp - I don't want to duplicate pages.
     
    misohoni, Jun 11, 2014 IP
  6. misohoni

    misohoni Notable Member

    Messages:
    1,717
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    200
    #6
    Could this be made in a permanent url? So it's a forced redirect?

     
    misohoni, Jun 13, 2014 IP