mercredi 8 février 2017

.htaccess redirect root domain to sub directory

Vote count: 0

I have an interesting .htaccess config that looks like this:

    RewriteEngine On
    # add a trailing slash if portal-pages/$1 is a directory
    RewriteCond %{DOCUMENT_ROOT}/portal-pages/$1 -d

    RewriteRule ^(.*[^/])$ %{REQUEST_URI}/ [L,R=301,NE]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(?!portal-pages/)(.*)$ portal-pages/$1 [L,NC]

So my real path would be something like this:

 http://ift.tt/2kswMva

but the .htaccess translates this path to this:

 local.com/home

it works great, but if I hit local.com I want it to redirect to local.com/home

How can I do this? Thanks in advance.

asked 25 secs ago

Let's block ads! (Why?)



.htaccess redirect root domain to sub directory

Aucun commentaire:

Enregistrer un commentaire