1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Removing File Extension Via htaccess

Discussion in 'Search Engine Optimization' started by Pathan, Dec 12, 2008.

  1. #1
    Hello,

    I want to know experts opinion about whether its good to remove the file extension from the URL? lets say i have a php page mysite.com/a.php I want to remove ".php" I know its possible with htacces, my question is will that help in SEO?

    Regards-
    Pathan
     
    Pathan, Dec 12, 2008 IP
  2. unna

    unna Well-Known Member

    Messages:
    3,274
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    140
    #2
    sorry i m deleting
     
    unna, Dec 12, 2008 IP
  3. LawnchairLarry

    LawnchairLarry Well-Known Member

    Messages:
    318
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    118
    #3
    Yes, you can rewrite file extensions using a few lines of coding in your .htaccess file. Be sure to read the mod_rewrite FAQ and these .htaccess tips and tricks and also make certain that your website is hosted on an Apache server with mod_rewrite enabled. However, from an SEO point of view it is not worth the time and effort you put into it unless you have a large website with various directories and subdirectories.
     
    LawnchairLarry, Dec 12, 2008 IP
  4. Pathan

    Pathan Well-Known Member

    Messages:
    2,196
    Likes Received:
    218
    Best Answers:
    0
    Trophy Points:
    165
    #4
    Thanks for your reply, well I have tested it on my server yeah its working as I am having Linux server, and regarding the SEO point of view I m thinking to use it on my new websites as I know its really hard to edit my existing sites pages.
     
    Pathan, Dec 12, 2008 IP
  5. Pathan

    Pathan Well-Known Member

    Messages:
    2,196
    Likes Received:
    218
    Best Answers:
    0
    Trophy Points:
    165
    #5
    One more question raised in my mind can i do that on few of the directories?
     
    Pathan, Dec 12, 2008 IP
  6. hassanahmad1

    hassanahmad1 Active Member

    Messages:
    150
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #6
    Yes.
    .htaccess affects its own directory and further subdirectories.
    so u can make the .htaccess file to affect a few directories only
     
    hassanahmad1, Dec 27, 2008 IP
  7. Pathan

    Pathan Well-Known Member

    Messages:
    2,196
    Likes Received:
    218
    Best Answers:
    0
    Trophy Points:
    165
    #7
    ahan thats really cool, will give that a try for sure, between I still want to know about is this effective in term of SEO?
     
    Pathan, Dec 27, 2008 IP
  8. cheapez

    cheapez Active Member

    Messages:
    1,123
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    78
    #8
    This works for a person that asked the same question. http://www.webmasterworld.com/apache/3371997.htm

    RewriteEngine on
    #
    ## Internally rewrite extensionless file requests to .php files ##
    #
    # If the requested URI does not contain a period in the final path-part
    RewriteCond %{REQUEST_URI} !(\.[^./]+)$
    # and if it does not exist as a directory
    RewriteCond %{REQUEST_FILENAME} !-d
    # and if it does not exist as a file
    RewriteCond %{REQUEST_FILENAME} !-f
    # then add .html to get the actual filename
    RewriteRule (.*) /$1.php [L]
    Code (markup):
     
    cheapez, Dec 27, 2008 IP
  9. poseidon

    poseidon Banned

    Messages:
    4,356
    Likes Received:
    246
    Best Answers:
    0
    Trophy Points:
    0
    #9
    extensions don't make any difference but its good to remove them so in the future, if you even move the platform, you can avoid lot of trouble
     
    poseidon, Dec 27, 2008 IP