I would like to change:
into just
http:// example.com/en/blog.html
or just
http:// example.com/blog.html
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think that you are trying to achieve more friendly URLs, so I’m assuming that wan to internally rewrite
http://example.com/en/blog.htmltohttp://example.com/index.php?p=blog&pid=2&lid=1&l=en.The most practical way that I can recommend is to rewrite everything to your PHP script, and do the rewriting internally in PHP. That way your PHP application can have full control over URIs.
In PHP, you can then access the original URI via superglobals:
$_SERVER[ "REQUEST_URI" ]. Note: sanitize, sanitize, sanitize!Edit
If you want to do the whole thing via
.htaccess, then see the example below. Note however that if you’ll expand your URI structure in the future (i.e. by adding new rules), then this approach might become more difficult to maintain as opposed to doing it within your PHP application.Edit #2: added a missing
^character in all three rules, i.e. changed([\/]*)to([^\/]*)