Page 1 of 1

htaccess rewrite code

Posted: Wed Sep 16, 2009 12:26 pm
by rajsekar2u
hi,

Am creating a website. the url of the site looks like below

http://www.example.php

I want to convert it into http://www.example.htm using .htaccess rewite. How to do it.
And also i want to change the following url

http://www.example.php?cmd=201

to

http://www.example.php

how do this with .htaccess rewrite

Please help me

Re: htaccess rewrite code

Posted: Wed Sep 16, 2009 12:32 pm
by superdezign
Have you tried searching Google for "htaccess mod_rewrite"?

Re: htaccess rewrite code

Posted: Wed Sep 16, 2009 11:14 pm
by rajsekar2u
Ya i've found something. But dont know which one to use.
Please guide me in this. Caz i haven't used htaccess yet. this is the first time.

Thanks in advance.

Re: htaccess rewrite code

Posted: Wed Sep 16, 2009 11:38 pm
by requinix
http://www.example.htm and http://www.example.php aren't valid. Want to try saying it again?

Re: htaccess rewrite code

Posted: Thu Sep 17, 2009 3:14 am
by rajsekar2u
http://example.php?cmd=somevalue

In the above url i want to hide ?cmd=somevalue

Is it possible in htaccess or any otherway

Re: htaccess rewrite code

Posted: Thu Sep 17, 2009 5:07 am
by amargharat
your url is wrong, you are saying http://example.php?cmd=value

it should be http://www.domain.com/example.php?cmd=value

Re: htaccess rewrite code

Posted: Fri Sep 18, 2009 12:54 am
by rajsekar2u
Sorry. I wrongly entered it.

The correct url is : http://www.domain.com/example.php?cmd=value

In this i want remove the value "cmd=value".

But i want the value of "cmd" in example.php page.

Re: htaccess rewrite code

Posted: Fri Sep 18, 2009 1:16 am
by amargharat
current url

http://www.domain.com/example.php?cmd=value

if you want to do rewrite in a following manner
http://www.domain.com/example/value

then in htaccess just write following line

Code: Select all

RewriteRule example/(.*)$ example.php?cmd=$1 // for numeric => ([0-9]+), for alphabets ([a-z]+)

Re: htaccess rewrite code

Posted: Fri Sep 18, 2009 11:57 pm
by rajsekar2u
Thanks.

I've another doubt.

http://www.domain.com/folder/example.php?cmd=value

If the url is like below what to change on below

Code: Select all

RewriteRule example/(.*)$ example.php?cmd=$1 // for numeric => ([0-9]+), for alphabets ([a-z]+)

Re: htaccess rewrite code

Posted: Sat Sep 19, 2009 1:33 am
by amargharat

Code: Select all

RewriteRule folder/example/(.*)$ folder/example.php?cmd=$1 // for numeric => ([0-9]+), for alphabets ([a-z]+)

Re: htaccess rewrite code

Posted: Sat Sep 19, 2009 1:34 am
by amargharat

Code: Select all

RewriteRule folder/example/(.*)$ folder/example.php?cmd=$1 // for numeric => ([0-9]+), for alphabets ([a-z]+)

Re: htaccess rewrite code

Posted: Sat Sep 19, 2009 3:19 am
by rajsekar2u
Thanks