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,
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)?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.