Let’s say I have a main folder in my website named “test” which contains an index.php file
http://www.example.com/test/index.php
How can I make it so that any url which contains this path “www.example.com/test” redirects to “www.example.com/test/index.php” and still hold the first request path
for example:
www.example.com/test/User redirects to www.example.com/test/index.php
www.example.com/test/User/2 redirects to www.example.com/test/index.php
www.example.com/test/Account redirects to www.example.com/test/index.php
www.example.com/test/Account/5 redirects to www.example.com/test/index.php
Use Apache’s Rewrite module. For example, in a virtual-hosts config, or in a directory’s
.htaccessfile, you might write this:This would make any URL that approached that directory redirect to
index.phpbut it would not change the URL the script parses.Here are some Godaddy.com docs on using rewrites in their hosting environment: