Tuesday 21 May 2013

url rewrite

URL rewriting on Linux Apache and wamp
For rewriting url on Centos Please do these steps.
  1. First go to '/etc/httpd/conf/httpd.conf' and for wamp left click on wamp icon and go to Apache then httpd.conf and uncomment - #LoadModule rewrite_module modules/mod_rewrite.so and #AddModule mod_rewrite.c, so do so please remove trailing #.

  2. Now Edit directory section in this file for directory /var/www/html and change 'AllowOverride none' to 'AllowOverride All'.

    Eg.
    Options Indexes FollowSymLinks
    AllowOverride none
    Order allow,deny
    Allow from all
    ;
    TO

    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    ;
  3. Now make a file in server root directory '/var/www/html' name .htaccess and write these line in this

Options +FollowSymlinks

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME}\.php -f

RewriteRule ^(.*).php$ $1.html [NC]

RewriteRule ^(.*).html$  $1.php [NC]



4-Now this will replace php extension in your file to .html extension  so now if you want to open index.php then write only http://url/index.html only instead of http://url/index.php

Tuesday 7 May 2013

for submit form on change jquery




<script>
$(document).ready(function() {
alert("hello");
    $('#catname').change(function() {
        $('form').submit();
    });
});


</script>