Apple iPod nano 8 GB Gumus
Canon Digital Rebel XT 8MP Digital SLR Camera with EF-S 18-55mm f3.5-5.6 Lens
Apple iPad 16gb Wi-Fi 3G
Apple iPod shuffle 1 GB Yesil
:: HOME APACHE htaccess configuration
htaccess configuration

.htaccess is used to set configuration of any specific directory. Nowadays, it mostly uses to create Search Engine Friendly pages. You can redirect any url typed with your domain to specific url. To be able to use you need modify your httpd.conf which is server configuration file and change AllowOverride to "all" and mod_rewrite  module for APACHE server. Than you can use .htaccess.


I will show some basic examples to help you learn how to use it.


RewriteEngine on

RewriteRule !\.(js|ico|gif|jpg|png|CSS)$ index.PHP


Over here, !(pattern) is used when url doesn’t match pattern. It means, if users type any js, ico, gif. Jpg, png or CSS file, it doesn’t apply this rule. Except these, it will apply this rule and redirect any PHP, HTML file to index.PHP file.


If we want to redirect just HTML files like when users types product_ABC.HTML, I want to redirect it to, product.PHP?product=ABC. So this is also search engine friendly page because search engines likes HTML pages.


RewriteRule product_(.*)\.htm$  product.PHP?product=$1


Here, at first we define url and (.*) means any thing and it will go to second page we defined. $1 first (.*) and we can use many of these like


RewriteRule products_(.*)_(.*)\.htm$  products.PHP?category=$1&brand=$2



If you want to redirect a directory to other;


RewriteCond %{HTTP_HOST} ^$ [OR]


RewriteCond %{HTTP_HOST} ^$


RewriteRule ^(.*)$ [R=301,L]


Here, rewriteCond shows condition you can see some words at the end [OR] means its has any more condition. R=301 means it is permanent address and L means it is last rule, end of [OR] for above conditions.



If you want to redirect any url like


RewriteRule ^([A-Za-z0-9-]+)/([0-9]+)/([A-Za-z0-9-]+)/([0-9]+)/?$ products.PHP?$1=$2&$3=$4 [L]


These are mostly used examples .


At last I want to say that if your APACHE server uses CGI or fastcgi and you always get an error message like "No input file specified". Put [PT] at the end of rules


RewriteRule !\.(js|ico|gif|jpg|png|CSS)$ index.PHP [PT]