0

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

1

2 Answers 2

1

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)

Sign up to request clarification or add additional context in comments.

1 Comment

Won't work unless he uses a domain.tld/cat/foo permalink structure, right?
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.