Answer the question
In order to leave comments, you need to log in
Mod_rewrite how to add handling of optional GET parameter to URL?
Given:
1. site.ru/?route=index
2. site.ru/?route=page
3. site.ru/?route=blog
4. site.ru/?route=blogpost&showpost=1
Need:
1. site. ru/index.html
2. site.ru/page.html
3. site.ru/blog.html
4. site.ru/blog/1.html
The problem is in the rule for the last example.
For the first three Rewrite Rules
RewriteEngine On
RewriteRule ^([^/]*)\.html$ /?route=$1 [L]
Answer the question
In order to leave comments, you need to log in
RewriteRule ^blog\/+(.+)\.html /?route=blogpost&showpost=$1 [L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question