1

I have tried almost every possible "solution" that I could find online for this matter, including Stackoverflow.

I am trying to rewrite

http://example.com/index.php?view=search&q=something

to

http://example.com/search/?q=something

When searching for something, the searchform direct's you to

search/?q=this

But "/search/" is allread passed once so it has already used the questionmark now i'm stuck with the script redirecting every search with a questionmark while it should be an "&" sign.

It works if I manualy change the ? to &.

Can someone pleas help me make it work with the Questionmark?

Here is a copy of my .htaccess

RewriteEngine on


RewriteCond %{REQUEST_FILENAME} !-f

ErrorDocument 404 /test.php


RewriteRule ^nothingfound/ test.php [L]

RewriteCond %{QUERY_STRING} q=([^&]+)
RewriteCond %{QUERY_STRING} v=([^&]+)
RewriteRule ^search/([^/]+) /index.php?view=search&q=%1


RewriteRule ^([^/.]+)/?$ index.php?view=$1 [L]
RewriteRule ^([^/.]+)/([^/.]+)/?$ index.php?view=$1&task=$2 [L]
RewriteRule ^([^/.]+)/([0-9]+)/([^/.]+)*/$ index.php?view=$1&id=$2&title=$3 [L]
RewriteRule ^([^/.]+)/([^/.]+)/([0-9]+)*/$ index.php?view=$1&task=$2&page=$3 [L]
RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/*/$ index.php?view=$1&task=$2&letter=$3 [L]
RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/([0-9]+)*/$ index.php?view=$1&task=$2&letter=$3&page=$4 [L]
RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/([0-9]+)/*/$  index.php?view=$1&id=$2&title=$3&page=$4 [L]
RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/([^/.]+)/*/$  index.php?view=$1&id=$2&title=$3&list=$4 [L]

Thanks in advance.

anubhava
  • 761,203
  • 64
  • 569
  • 643
rokkz
  • 179
  • 1
  • 1
  • 13
  • Sorry, it is hard to understand your problem. Could you please provide a list of a few example urls, how they are currently rewritten and what the issue is with that? – arkascha Feb 16 '14 at 00:54
  • http://example.com/blogs/top/ for example is = http://example.com/index.php?view=blogs&task=top – rokkz Feb 16 '14 at 01:07
  • Possible duplicate - http://stackoverflow.com/questions/822421/match-question-mark-in-mod-rewrite-rule-regex – tgun926 Feb 16 '14 at 01:07
  • Sorry, I still don't see the problem here. I am out. – arkascha Feb 16 '14 at 01:08

2 Answers2

0

Is this what you're looking for?

Replace this

RewriteCond %{QUERY_STRING} q=([^&]+)
RewriteCond %{QUERY_STRING} v=([^&]+)
RewriteRule ^search/([^/]+) /index.php?view=search&q=%1

with this

RewriteCond %{QUERY_STRING} \bq=
RewriteRule ^search/$ index.php?view=search [QSA,L]
Panama Jack
  • 24,158
  • 10
  • 63
  • 95
0

This rule should work for you:

RewriteCond %{QUERY_STRING} (^|&)[qv]=.+ [NC]
RewriteRule ^(search)/?$ index.php?view=$1 [QSA,L,NC]
anubhava
  • 761,203
  • 64
  • 569
  • 643