Rewrite URL term(s) separated by equal sign to query string(s)?

I see two main approaches: 1 More safer/easier to understand and extend if necessary Make two rules : 1st will catch thanks=stackoverflow while 2nd will work with thanks only: RewriteEngine On # do not do anything for already existing files RewriteCond %{REQUEST_FILENAME} -f OR RewriteCond %{REQUEST_FILENAME} -d RewriteRule . + - L # will work with /thanks=stackoverflow RewriteRule ^(^/=+)=(^/=+)/? $ index.

Php? A=$1&b=$2 L # will work with /thanks RewriteRule ^(^/=+)/? $ index.

Php? A=$1 L 2 Combine those two rules into a single rule In this case parameter be will always be present, but will be empty for thanks scenario: RewriteCond %{REQUEST_FILENAME}! -f RewriteCond %{REQUEST_FILENAME}!

-d RewriteRule ^(^/=+)(=(^/=+))? /? $ index.

Php? A=$1&b=$3 L Tested both -- working fine on my Apache box.

I see two main approaches: 1. More safer/easier to understand and extend if necessary. Make two rules: 1st will catch thanks=stackoverflow while 2nd will work with thanks only: RewriteEngine On # do not do anything for already existing files RewriteCond %{REQUEST_FILENAME} -f OR RewriteCond %{REQUEST_FILENAME} -d RewriteRule .

+ - L # will work with /thanks=stackoverflow RewriteRule ^(^/=+)=(^/=+)/? $ index. Php?

A=$1&b=$2 L # will work with /thanks RewriteRule ^(^/=+)/? $ index. Php?

A=$1 L 2. Combine those two rules into a single rule. In this case parameter b= will always be present, but will be empty for thanks scenario: RewriteCond %{REQUEST_FILENAME}!

-f RewriteCond %{REQUEST_FILENAME}! -d RewriteRule ^(^/=+)(=(^/=+))? /?

$ index. Php? A=$1&b=$3 L Tested both -- working fine on my Apache box.

Thank you! Both of your examples are working great here, too. I really appreciate the detailed solutions; they've helped improve my understanding of mod_rewrite.

After hours of throwing darts at my problem I now see where I was going wrong thanks to your answer. – kiteman Aug 22 at 2:27.

Why not create two seperate rewrite rules: i) One that takes care of example 1 - with the added check that it does not contain an equal sign so that you don't match example 2 with rewrite rule 1 ii) Another one that takes care of example 2.

Thanks for the helpful insight towards a solution. I've accepted LazyOne's answer as it included working code but you helped steer me in the right direction initially. – kiteman Aug 22 at 2:28.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions