I must change: http://example.com/index.php?p=blog&pid=2&lid=1&l=en
into just http:// example.com/en/blog.html or simply http:// example.com/blog.html
thanks ahead of time!
I think that you're attempting to get more tasks completed friendly Web addresses, so I am presuming that wan to internally rewrite
The most practical method will be able to recommend would be to rewrite everything for your PHP script, and perform the spinning internally in PHP. This way your PHP application might have full treatments for URIs.
RewriteEngine On RewriteBase / RewriteRule .* index.php [L]
In PHP, after that you can access the initial URI via superglobals:
$_SERVER[ "REQUEST_URI" ]. Note: sanitize, sanitize, sanitize!
If you wish to perform the whole factor via
.htaccess, then begin to see the example below. Note however when you'll expand your URI structure later on (i.e. with the addition of new rules), than the approach might are more hard to maintain instead of doing the work in your PHP application.
RewriteEngine On RewriteBase / # http://example.com/en/blog.html RewriteRule ^([^\/]*)/([^\/]*)\.html$ index.php?l=$1&p=$2 [NC,QSA,L] # http://example.com/blog.html RewriteRule ^([^\/]*)\.html$ index.php?p=$1 [NC,QSA,L] # alternatively you can change the last line to add a default language (if not present) RewriteRule ^([^\/]*)\.html$ index.php?l=sk&p=$1 [NC,QSA,L]
Edit #2: added military services weapons
^ character in most three rules, i.e. transformed