使用的.htaccess重定向到一个子文件夹文件夹、重定向、htaccess

2023-09-02 01:11:04 作者:恰似显出

我搬一个网站转移到子文件夹,我添加了一个htaccess文件到网站的根目录。出于某种原因,它不重定向到子文件夹。下面是我的code

 选项+了FollowSymLinks


#
#mod_rewrite的使用

RewriteEngine叙述上

的RewriteBase /的public_html /总公司/
 

我也试过

 选项+了FollowSymLinks


#
#mod_rewrite的使用

RewriteEngine叙述上

的RewriteBase / CORP /
 

该网站实际上是一个文件夹,名为在/ CORP /

解决方案

 的DirectoryIndex /corp/index.php
 
删除文件夹重定向

 选项+了FollowSymLinks
RewriteEngine叙述上
的RewriteBase /
RewriteEngine叙述上

的RewriteCond%{HTTP_HOST} ^(WWW)?domain.com $
重写规则^(/)?$ CORP [L,R = 301]
 

是其他的替代方法为好。

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.