I am trying to rewrite http://abc.com/sub/random.php to http://abc.com/random.
I have tried
RewriteRule ^random$ sub/random.php [QSA,L]
But it does not work for some reason.
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.
It doesn’t make much sense to show the “ugly” URL with the resource in the browser’s address bar:
http://abc.com/sub/random.php, while hiding the “pretty” URLhttp://abc.com/random. So, I assumed you want the opposite of what you asked.If that is correct, you may try this:
It will map silently this:
http://abc.com/randomTo this:
http://abc.com/sub/random.phpWhere
randomis not a fixed string but a variable that is passed as the name of the script.