[share] let's discuss .htaccess

Discussion in 'Programming' started by moonlight, Jan 7, 2009.

  1. #1
    hello guys, I made this thread to share about .htaccess so we can learn together and share each other.

    alright, first start with me

    .htaccess is Hyper Text (Transfer Protocol) Access File, use to control files and usually applied to the apache web server.
    there are so many things we can do with .htaccess such as forbid the access to the files, friendly 404 page not found, mod rewrite, etc

    ok now first tips I'm gonna share how to lock 'www' in the 'website url'
    RewriteEngine on 
    RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC]
    RewriteRule ^(.*) http://www.mydomain.com/$1 [L,R=301]
    Code (markup):
    try to copy the code on .htaccess in your website root, if htaccess not exist you can make your own.
    that rewrite code, every user that comin to yourdomain.com will directly redirect 301 to http://www.yourdomain.com

    so what's the benefit? well it's one of the SEO technique so it won't be any duplicate indexing happen. beside that you can also always use www or not use at all it'll be the same, me myself choose to use www coz it's very common for the website.
    but before you try that code, first try are http://yourdomain.com and www.yourdomain.com will point to the same address?

    have a nice try!
     
    moonlight, Jan 7, 2009 IP
  2. web_doctor

    web_doctor Peon

    Messages:
    164
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    hmm... this is great.

    I am looking for an .htaccess that removes an "index.php" or "index.html" or "index.*" for my site, can you please teach me how?
     
    web_doctor, Jan 29, 2009 IP
  3. web_doctor

    web_doctor Peon

    Messages:
    164
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ummm, long period of time I wasnt able to visit my threads. Anyway, I solved my own problem about htacess on CodeIgniter... :)
     
    web_doctor, Jun 29, 2010 IP