Motheus
Motheus

Reputation: 543

Why this .htaccess with 1 variable won't work?

I'm trying to get this but i really don't know why won't work. I try to change things and params and won't work:

RewriteCond %{QUERY_STRING} board=([0-9]+).0
RewriteRule ^forum/index\.php$ index.php?option=/$1? [R=301,L]

url:
www.abc.com/forum/index.php?board=13.0

Upvotes: 0

Views: 90

Answers (1)

Felipe Alameda A
Felipe Alameda A

Reputation: 11799

It should be something like this:

RewriteCond %{QUERY_STRING} board=([0-9]+)\.0
RewriteRule ^(forum/index\.php)/?$ index.php?option=/$1? [R=301,L]

That way the back reference $1 gets the group inside () in the regex.

Modify accordingly with what should be inside the round brackets.

UPDATE

RewriteCond %{QUERY_STRING} board=([0-9]+)\.0
RewriteRule ^forum/index\.php/?$ index.php?option=/%1? [R=301,L]

Back reference %1 gets the group in the previous condition's Regex (Value of Board).

Upvotes: 1

Related Questions