: Skip part of URL I have a server running on XAMPP in LAN. In htdocs I've created subfolder called 'apps' (it's because I'm using one CodeIgniter's files to multiple webpages). Now, when somenone
I have a server running on XAMPP in LAN.
In htdocs I've created subfolder called 'apps' (it's because I'm using one CodeIgniter's files to multiple webpages).
Now, when somenone want to visit a webpage, must visit: myserver/apps/app_name.
Is it possible with .htaccess (or else) to skip that /apps/ part? myserver/app_name ?
More posts by @LarsenBagley505
1 Comments
Sorted by latest first Latest Oldest Best
Activate mod_rewrite, and put this in a .htaccess file or a <Directory> directive:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_URI} !^apps/
RewriteRule (.*) apps/
What it does:
The first three lines check if the requested URI refers to an actually existing file, directory or link, in order to make sure that e.g. an index.html at top level is still delivered if requested.
The fourth line makes sure that the user has not already requested an URI in the apps/ subpath.
If the requested URI is not an existing file, directory or link and does not start with apps/, the path of the URL is taken and apps/ is prepended. This only happens internally.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.