Is there a way I can use PHP (and/or .htaccess) to rewrite the URL of a page.
For example if a user goes to http://www.mysite.com/french they are actually accessing the page which is http://www.mysite.com/index.php?lang=fr
But not a redirect.
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.
on the Apache site you can find several examples of URL rewriting flavors, by the way it’s enough to use something like this in an .htaccess file:
Where
[flag]can be one of the following:You may want to have a look at the PT (passthrough) flag docs or RewriteRule flags docs.
Also, pay attention to what your links are pointing to: in fact, the RewriteRule first argument is a regular expression that will be used to match the URLs to be rewritten. At the moment,
matches “french”, right after the domain name,followed either by a slash (/) or nothing (that’s the meaning of
(/|)); that is, it’ll match http://www.mysite.com/french and http://www.mysite.com/french/ but nothing else. If you need to parse query string arguments, or subpaths, then you may need a more complex regex.