URL modification (insert) string in URL using .htaccess

Discussion in 'Apache' started by atpaz, Sep 13, 2011.

  1. #1
    Hi everyone,

    my server using apache directory index configuration :

    DirectoryIndex index.html index.php

    i have both file, i want if there query string 'p' in URL then index.php will do the job, but if no query string then index.html will take the rule

    mysite.com/?p=12134

    will be parse into

    mysite.com/index.php?p=12134



    i had try the following .htaccess code but got no luck

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /
    RewriteRule \?p=(.*)$ "/index.php?p=$1" [L]
    </IfModule>


    any help? :confused: please
     
    atpaz, Sep 13, 2011 IP