kwaxy
kwaxy

Reputation: 31

.htaccess rewrite url with parameter

I want to change my url with only the parameter. As I am passing only one parameter, so I want the sub url should be changed with my parameter name. I want change the url as the following type-

From:

http://www.xyz.com/cat.php?slag=season

to

http://www.xyz.com/season

Can anyone help me to do it. I don't know how to do it. Thanks

Upvotes: 0

Views: 520

Answers (2)

balanv
balanv

Reputation: 10888


Options +FollowSymLinks 
RewriteEngine On  
RewriteBase /path/to/your/directory 
RewriteRule ^(.*)cat/(.*)$ cat\.php?slag=$2&%{QUERY_STRING} [L]

put the above in your .htaccess file.. and that would do the magic..

Note : RewriteBase /path/to/your/directory (use this line only if your application is in any of subfolder the folder)

Upvotes: 1

vzwick
vzwick

Reputation: 11044

I suggest you obtain a copy of the .htaccess that WordPress uses. It's a quite powerful starting point that allows you to handle routing internally from within your Application - which you might feel more comfortable with, as it seems to me.

Upvotes: 0

Related Questions