Possible Duplicate:
Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask?

How do I substitute http://mydomain.com/dir1/dir2/test.php for http://mydomain.com/test.php?

link|improve this question
It would help to mention platform/webserver. I'm guessing at a flavour of Apache with the mod_rewrite module. – Michael Henry Feb 10 '11 at 16:00
feedback

closed as exact duplicate by sysadmin1138 Mar 29 '11 at 13:53

This question covers exactly the same ground as earlier questions on this topic; its answers may be merged with another identical question. See the FAQ for guidance on how to improve it.

1 Answer

It would help to mention platform/webserver. I'm guessing at a flavour of Apache with the mod_rewrite module.

If everything is under this new subdir, redirect root ie.

RewriteEngine on

RewriteRule ^/$ /dir1/dir2/ [R]

or if you want ot explicit about a single file.

RewriteEngine on

RewriteRule ^/test.php /dir1/dir2/test.php [R]

M.

link|improve this answer
feedback

Not the answer you're looking for? Browse other questions tagged or ask your own question.