1

So I have a url:

www.example.com/?action=viewCategoryName&categoryName=Events&page_identifier=about

And would like to create a rule that would return the page if the following is entered:

'www.example.com/events/about'

Is it possible to write the rule to include the two query strings? I have come up with the below but its not working as expected.

RewriteRule ^$2/([a-z0-9,&-]+)/?$1 ?viewCategoryNameandArticle&categoryName=$2&page_identifier=$1 [L,NC,QSA,B]

Many Thanks! Adam

1 Answer 1

1

You can use this rule

RewriteRule ^([^/]+)/([^/]+)$ /?action=viewCategoryName&categoryName=$1&page_identifier=$2 [L]
Sign up to request clarification or add additional context in comments.

3 Comments

perfect! Will accept your answer in 9 minutes :) Many thanks Justin!!
Would you mind explaining how to include an ambersand/& in the regular expression? I've tried ([^/]+)/([^/],&-+)$
Ampersand (&) is already accepted with my rule. Actually, the pattern [^/]+ means one or more characters except /

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.