![](/img/trans.png)
[英].htaccess to redirect everything to index.php, but keep a copy of the website in a subdirectory
[英]Redirect everything BUT index.php with htaccess
我对自己拥有的网站以及如何配置.htaccess文件感到困惑。
我只是在mysite.com上建立了一个论坛,因为我想添加一个博客,所以我将301重定向并将所有内容移到了一个目录mysite.com/forum/中,一切都很好。
但是现在我想拥有一个不同的索引页面,以便人们可以选择进入博客(实际上是博客)还是进入论坛。
我试图避免丢失一些已经被网络搜索者索引的页面。
现在,我网站根目录中的htaccess文件如下所示:
Options +FollowSymLinks
RewriteEngine on
<Files 403.shtml>
order allow,deny
allow from all
</Files>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Redirigir el dominio sin www a www
RewriteCond %{HTTP_HOST} ^mysite\.com$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,QSA,L]
RewriteRule (.*) http://www.mysite.com/forum/$1 [R=301,L]
</IfModule>
有没有办法放一些东西
If request URL = root then index.php
Else http://www.mysite.com/forum/$1
谢谢你的帮助
干杯!
您可能想要类似
# if request = root
RewriteRule ^/?$ /index.php [L]
# else
RewriteRule !^/?(index\.php)?$ http://www.mysite.com/forum%{REQUEST_URI} [L,R=301]
替换您拥有的最后一条规则
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.