Urgent Help Needed With Url .htaccess

Discussion in 'Apache' started by indyature, May 13, 2013.

  1. #1
    http://gopincode.com/pincode.net.in/ANDAMAN_AND_NICOBAR_ISLANDS/NICOBAR/

    to

    http://gopincode.com/pincode.net.in/ANDAMAN_AND_NICOBAR_ISLANDS/NICOBAR.html


    Help how to change this with .htaccess. Please anyone provide with the code that i have to use in htaccess.
     
    indyature, May 13, 2013 IP
  2. Isuru

    Isuru Active Member

    Messages:
    363
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    68
    #2
    Try this,

    # add .html file extension
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.html -f
    RewriteRule ^ANDAMAN_AND_NICOBAR_ISLANDS/(.+)$ /ANDAMAN_AND_NICOBAR_ISLANDS/$1.html [L]
    Code (markup):
     
    Isuru, May 13, 2013 IP
  3. indyature

    indyature Member

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    38
    #3
    Not only this url there are many is there any common term to change the last / in to .html
     
    indyature, May 13, 2013 IP
  4. Isuru

    Isuru Active Member

    Messages:
    363
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    68
    #4
    Try this,

    Options FollowSymLinks
     
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^.*\.html$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ %{REQUEST_FILENAME}.html
    Code (markup):
    Let me know if it works.
     
    Isuru, May 14, 2013 IP
  5. indyature

    indyature Member

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    38
    #5
    Not Working Friend
     
    indyature, May 14, 2013 IP
  6. Isuru

    Isuru Active Member

    Messages:
    363
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    68
    #6

    Strange put your question in stackoverflow with your server details.
     
    Isuru, May 14, 2013 IP