Here’s an example of what I’m trying to do.
Turn this:
http://example.com/products/
into this:
http://example.com/app.php?products
I also need support for queries at the end, for example::
this:
http://example.com/products/?foo=bar&boat=row
into this:
http://example.com/app.php?products&foo=bar&boat=row
This is my rewrite so far:
RewriteRule ^([A-Za-z0-9]+)/?\??([A-Za-z0-9\+=&]+)?$ app.php?$1&$2 [L]
This works for my first two example, however the second example only works for a url like
http://example.com/products/foo=bar&boat=row
I need to be able to have that question mark in there, which I think \?? in my rewrite should do, but it doesn’t, and instad returns 404. What am I doing wrong? Thanks.
The query string can be appended using the
QSAflag, you can’t match against the query string in aRewriteRule. Try this: