[英]Redirect everything BUT index.php with htaccess
I have a dilemma with a site I own and how to configure the .htaccess file. 我对自己拥有的网站以及如何配置.htaccess文件感到困惑。
I just to had a forum in mysite.com, since I wanted to add a blog I put a 301 redirect and move everything to a dir mysite.com/forum/, all good there. 我只是在mysite.com上建立了一个论坛,因为我想添加一个博客,所以我将301重定向并将所有内容移到了一个目录mysite.com/forum/中,一切都很好。
But now I want to had a different index page so people can choose between go to the blog (blogs actually) or go to the forum. 但是现在我想拥有一个不同的索引页面,以便人们可以选择进入博客(实际上是博客)还是进入论坛。
I trying to avoid losing several pages already indexed by web searchers. 我试图避免丢失一些已经被网络搜索者索引的页面。
Right now the htaccess file in the root of my site looks like: 现在,我网站根目录中的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>
Is there a way to put something like 有没有办法放一些东西
If request URL = root then index.php
Else http://www.mysite.com/forum/$1
Thanks for your help 谢谢你的帮助
Cheers! 干杯!
You probably want something like 您可能想要类似
# if request = root
RewriteRule ^/?$ /index.php [L]
# else
RewriteRule !^/?(index\.php)?$ http://www.mysite.com/forum%{REQUEST_URI} [L,R=301]
To replace the last rule that you have 替换您拥有的最后一条规则
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.