I have been using this rule:
RewriteRule ^([^\.]+)/?$ index.php?page=$1 [L]
Which will turn
example.com/page/hello
…into
example.com/index.php?page/hello
However, if I have a file extension on the end of that, say,
example.com/page/hello/doc.html
…it doesn’t work. How can I make that URL become:
example.com/index.php?page/hello/doc.html
…and
example.com/page/
…become:
example.com/index.php?page/
Thank you very much if you are able to help with this. I’ve tried fiddling with the regular expression, but I just can’t make it work.
Thanks.
This section of your regex will match one or more characters that are anything except a full stop:
If you want to match one or more of any character, then just write:
instead