I am currently building a website and it hasn't gone online, I am using wamp server 2.4. I need to remove the sub directories so as to not let out the structure of my directories, I have a test site with the following folders: includes and sub.
The links to be accessed are in sub so if the user clicks on a link that goes to sub/link.php
, the url shows localhost/sub/link.php
..I would like it to show localhost/test/link/
without the sub showing. So far I have googled mod_rewrite
in Apache, learnt about it but still unable to remove sub-directory. All I have achieved is to remove the file extension(.php).
I have searched here on Stack Overflow but the answers are not helping maybe because they use online hosted websites. The link.php has no variables, it's a simple php file that could echo stuff but it's not using any GET/POST variables.
This is the html code, i have intentionally written one 't' in 'http'..though in the code it is two..
Link
RewriteEngine On
RewriteRule ^sub/(.*)$ /$1 [L,R=301]
Take a look at this site, it's hosted on wordpress and every link that you go to is shown without any subdirectories, it's just got one trailing slash after the url, is it possible to achieve that on apache?