In ubuntu, i am running simple html page that can run mp4 video, i have configured Apache Server and have run simple test page for hello world, its working fine. In Apache Webserver i have read that we need to add the following code to httpd.conf file or to an .htaccess file in the directory where our video files are.

AddType video/ogg .ogv
AddType video/mp4 .mp4
AddType video/webm .webm

So my question is where is this httpd.conf or .htaccess file available, do i manually need to create these files or they are stored somewhere.

The code of my HTML Page is like this :

<video width="320" height="240" controls>
  <source src="test.mp4" type="video/mp4">
  <source src="test.ogg" type="video/ogg">

Please give me the suggestions.


  • The httpd.conf is located at /etc/apache2/httpd.conf and it's a good idea to make a backup of the original file before you play around with it. As for the .htaccess file, please refer to @dobey 's answer – Nitin Venkatesh Feb 20 '13 at 15:15
  • sit its not located there.. – user121420 Feb 20 '13 at 15:25
  • The default file is /etc/apache2/sites-enabled/000-default, sorry about the earlier path. – Nitin Venkatesh Feb 20 '13 at 15:31

I added "webm" to /etc/mime.types, which was picked up by Apache as well:

video/webm                                     webm

The default configuration file for the files being served by your Apache installation is /etc/apache2/sites-enabled/000-default. It's a good idea to backup the original file before you play around with this file.

#To make a backup of the original config file:    
sudo cp /etc/apache2/sites-enabled/000-default /etc/apache2/sites-enabled/000-default.orig

Everytime you edit this file, Apache has to be restarted/reloaded for the changes to take effect - sudo service apache2 restart (or) sudo service apache2 reload, whereas changes in .htaccess do not require Apache to be restarted. As @dobey mentioned, the .htaccess file goes in the DocumentRoot of the web site.

Take a look at the official documentation on how to enable .htaccess files.


To make .htaccess files work as expected, you need to edit this file:


Look for a section that looks like this:

<Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
        # Uncomment this directive is you want to see apache2's
        # default start page (in /apache2-default) when you go to /
        #RedirectMatch ^/$ /apache2-default/

You need to modify the line containing AllowOverride None to read AllowOverride All. This tells Apache that it's okay to allow .htaccess files to over-ride previous directives. You must reload Apache before this change will have an effect:

sudo /etc/init.d/apache2 reload

2009.12.08 note: in the LAMP download about a week ago with Ubuntu 9.10 (Karmic) the default configuration file was /etc/apache2/sites-available/000-default and it included AllowOverride None under <Directory /> in addition to <Directory /var/www/>. Also, directories in /www/var/ containing .htaccess files defaulted to not giving the Apache server read access, resulting in the Apache error

(13)Permission denied: /var/www/webapp/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable. 

To fix, $ sudo nautilus then right click on the directory with the .htaccess file, select Properties, then select Permissions, and give the user group you log in as at least read permission.

See http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride for more info on AllowOverride.


The .htaccess file would be something you create in the DocumentRoot directory of your web site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.