使用的.htaccess重定向到一个子文件夹 [英] Redirect to a sub folder using .htaccess

查看:412
本文介绍了使用的.htaccess重定向到一个子文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搬一个网站转移到子文件夹,我添加了一个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.

这篇关于使用的.htaccess重定向到一个子文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆