本文介绍了htaccess的:域名托管在子目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我在www.mydomain.com/myniceweb主办的网站,我买的域名www.myniceweb.com

I have a website hosted under www.mydomain.com/myniceweb, and I bought the domain www.myniceweb.com

它工作正常,但我不希望观众能够看到子文件夹(www.mydomain.com/myniceweb),我不希望谷歌认为有2个不同的网站使用相同的内容......

It works fine, but I don't want the visitors to be able to see the subfolder (www.mydomain.com/myniceweb), and I don't want google to think there are 2 different websites with the same content...

我试图修改.htaccess文件没有结果:

I tried modifying the .htaccess file with no results:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(www.)?myniceweb.com$
RewriteCond %{REQUEST_URI} !^/myniceweb/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /myniceweb/$1

RewriteCond %{HTTP_HOST} ^(www.)?myniceweb.com$
RewriteRule ^(/)?$ myniceweb/index.php [L]

我想重定向访问www.mydomain.com/myniceweb到www.myniceweb.com用户如何我能做到这一点?

I want to "redirect" the users that access www.mydomain.com/myniceweb to www.myniceweb.com How can I do this?

我会很感激你的帮助!

推荐答案

好了,我终于做到了,我想与你们分享它...它可以帮助别人的同样的问题:

Well, I finally did it and I want to share it with you guys...it may help someone with the same issue:

RedirectMatch 301 ^/farmaciagimeno.com(.*)$ http://www.farmaciagimeno.com$1

写这个插入的.htaccess(一个位于/ myniceweb夹,而不是根文件夹),任何请求yourdomain.com/myniceweb将要被重定向到www.myniceweb.com

writing this into your .htaccess (the one located in the /myniceweb folder, not the root folder), any request to yourdomain.com/myniceweb is going to be redirected to www.myniceweb.com

这篇关于htaccess的:域名托管在子目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 17:57