Mobile app version of vmapp.org
Login or Join
LarsenBagley505

: 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

@LarsenBagley505

Posted in: #Htaccess #Url #Xampp

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 ?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @LarsenBagley505

1 Comments

Sorted by latest first Latest Oldest Best

 

@Berryessa370

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme