Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 has been asked before and already has an answer. If those answers do not fully address your question, please ask a new 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
add comment

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.

share|improve this answer
add comment

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