Flipkart

Showing posts with label Apache. Show all posts
Showing posts with label Apache. Show all posts

Tuesday, June 8, 2010

What is .htaccess Files

.htaccess files (or “distributed configuration files”) provide a way to make
configuration changes on a per-directory basis. A file, containing one or more
configuration directives, is placed in a particular document directory, and the
directives apply to that directory, and all subdirectories thereof.


Directives

“Directives” is the terminology that Apache uses for the commands in Apache’s
configuration files. They are normally relatively short commands, typically
key value pairs, that modify Apache’s behavior. An .htaccess file allows
developers to execute a bunch of these directives without requiring access to
Apache’s core server configuration file, often named httpd.conf.
This file,
httpd.conf, is typically referred to as the “global configuration file” and I will
refer to it with that name or its short filename equivalent.
This feature is ideal for many hosting companies deploying a shared hosting
environment. The hosting company will not allow its customers to access the
global configuration file, which ultimately affects all of the customers hosted on
that server. Instead, by enabling .htaccess, they give each of their customers
the power to specify and execute their own Apache directives in their own
directories and subdirectories. Of course it’s also useful to the single
developer, as you will see.
It’s worth mentioning that anything that can be done with a .htaccess file can
be done in the httpd.conf file. However, NOT everything that can be done in
httpd.conf can be done in a .htaccess file. In fact .htaccess files must be
enabled in the httpd.conf file in order to be executed at all. Once enabled,
their power can be limited to certain “contexts” so that they may be allowed
to override some settings but not others. This gives the system administrators
more control over what they let other developers get away with in their
.htaccess files.

for more Information about htaccess Click here

Wednesday, April 14, 2010

Write PHP Code in HTML File

Here is the way to write the PHP logic in HTML File(i.e .html file).

In two ways we can achieve this.

1.change the setting in apache configuration file(i.e httpd.conf)

AddType application/x-httpd-php .php ---> AddType application/x-httpd-php .php .html

2. If you don't have the access to httpd.conf you can write .htacees file as

AddType application/x-httpd-php .php .htm .html

and then restart the apache webserver.

Thursday, March 25, 2010

Enable mode_rewrite module in xampp

If you running XAMPP on Windows and unable to figure out how to enable mod_rewrite in apache then here is the solution and it is very simple

Search for httpd.conf file in xampp folder it should be located at xampp/apache/conf and open file in any editor and search for below line:

#LoadModule rewrite_module modules/mod_rewrite.so

and just remove the "#" symbol then it will be like

LoadModule rewrite_module modules/mod_rewrite.so

Next, search for "AllowOverride None" and change it to "AllowOverride All". It is correct once and wrong twice in the file.

Once you have made these changes, save httpd.conf file and restart Apache for mod_rewrite to take effect.