2

Hello today i tried to rewrite few things, i tried to rewrite this:

www.example.com/index.php?title=how+do+man+live?

To:

www.example.com/posts/how+do+man+live?/

Now the problem is that the question mark appears only at url and when i post the $_GET variable(title..) its post everything but not the question mark.

i tried put in rewrite mdoe this:

RewriteRule post/([0-9א-בa-zA-Z+.`?]+)/?$ index.php?title=$1 [NC]

course that the Rewrite engine is on. thank you guys, have wonderful day!

anubhava
  • 761,203
  • 64
  • 569
  • 643
jeskey boneman
  • 227
  • 1
  • 9

1 Answers1

1

You need to capture this value from THE_REQUEST variable to be able to capture ? also. Use this rule in root .htaccess:

RewriteEngine On

RewriteCond %{THE_REQUEST} \s/+posts/(\S+) [NC]
RewriteRule ^ index.php?title=%1 [L,QSA]
anubhava
  • 761,203
  • 64
  • 569
  • 643
  • Thank you very much. but now the url are sensetive to the appear of / in the end i mean:example/posts/how+are+you?/ work and example.com/posts/how+are+you? doesnt work – jeskey boneman Oct 17 '14 at 22:19
  • I think `[B]` should also be passed here: https://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_b – hjpotter92 Oct 17 '14 at 23:57
  • Actually I had tested with `B` and without `B` before posting this answer. With `B` flag `$_GET['title']` becomes `how+do+man+live?/` and without `B` it comes `how do man live?/` – anubhava Oct 18 '14 at 06:47