Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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

This question was marked as an exact duplicate of an existing 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

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.

share|improve this answer

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