redirect - PHP redirecting all pathes to a certain php file? -


Assume that my website has a main folder named "test" in which an index.php file is located at www.mywebsite.com. is. /test/index.php

How can I create this so that "www.mywebsite.com/test" redirects this URL to "www.mywebsite.com/test/index.php" in this URL to be done. And still hold the first request path

For example:

  www.myWebsite.com/test/User www.myWebsite.com/test/index.php Redirect www. Www.mywebsite.com / test / user / 2 redirect www.mywebsite.com/test/account Redirect www.mywebsite.com at www.mywebsite.com/test/index.php www.mywebsite.com/test/index.php /test/index.php www.mywebsite.com / test / account / 5 redirects to www.mywebsite.com/test/index.php  

Use Apache for example, in the virtual-host config, or in a .htaccess file of a directory, you can write it to: < / P>

  RewriteEngine RewriteCond% {REQUEST_FILENAME} -s [OR] rewrite condom% {REQUEST_FILENAME} -l [OR] Rewritecode% {REQUEST_FILENAME} -d Rivetrium ^. * $ - [NC, L] Remit Rules ^. * $ Index.php [nc, l]  

This will create the URL that will redirect that directory to index.php , but this URL script purse Will not change.


Here are some of the Godaddy's re-writing in their hosting environment. Docs:


Comments