简体   繁体   中英

Redirect to a sub folder using .htaccess

I moved a website over to a sub folder and I added a htaccess file to the root of the site. For some reason it is not redirecting to the subfolder. below is my code

Options +FollowSymLinks


#
#  mod_rewrite in use

RewriteEngine on

RewriteBase /public_html/corp/

i also tried

Options +FollowSymLinks


#
#  mod_rewrite in use

RewriteEngine on

RewriteBase /corp/

The site is actually in a folder called /corp/

 DirectoryIndex /corp/index.php

or

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteEngine On 

RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteRule ^(/)?$ corp [L,R=301]

Are other alternative methods as well.

RewriteBase only specifies the base for every RewriteRule . If you don't have a RewriteRule , there won't be a rewrite.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM