Or Weinberger
Or Weinberger

Reputation: 7482

htaccess non permanent redirect (301)

I'm trying to redirect every visitor that tries to enter my homepage (http://www.mysite.com/) to the Pub directory (http://www.mysite.com/Pub/)

I want the url field to show http://www.mysite.com and not http://www.mysite.com/Pub/

I've tried this, but for some reason it doesn't work:

Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /

RewriteRule / /Pub/

Thanks,

Upvotes: 0

Views: 422

Answers (2)

anubhava
anubhava

Reputation: 785531

Have your rule in .htacess like this:

RewriteEngine on
Options +FollowSymlinks -MultiViews

RewriteRule ^/?$ /Pub/ [L]

It is important to not use R flag above so that its an internal redirect only without changing URL in the browser.

Upvotes: 0

Esse
Esse

Reputation: 3298

The answer is here: how to mask URL with htaccess?

long story short - it's impossible to show http://www.mysite.com and not http://www.mysite.com/Pub/.

Btw - you mean permanent redirect (301) or non permanent redirect (307)?

Upvotes: 1

Related Questions