Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess htaccess 301从多个URL重定向到单个joomla站点_.htaccess_Redirect_Joomla - Fatal编程技术网

.htaccess htaccess 301从多个URL重定向到单个joomla站点

.htaccess htaccess 301从多个URL重定向到单个joomla站点,.htaccess,redirect,joomla,.htaccess,Redirect,Joomla,我在服务器上设置了一个joomla站点,有4个URL指向它。 我想有3个这样的网站做一个重定向到第四,以提高网站在搜索引擎上的地位。 如果URL为: web1.com.ar web1.com www.web1.com.ar www.web1.com 我希望他们都能将trafic重定向到www.web1.com 问题是,我在网站上使用joomla,因此99%的时间人们都应该进入类似“www.web1.com.ar/index.php/stuff/morestuff/something.html”这

我在服务器上设置了一个joomla站点,有4个URL指向它。 我想有3个这样的网站做一个重定向到第四,以提高网站在搜索引擎上的地位。 如果URL为:

web1.com.ar web1.com www.web1.com.ar www.web1.com

我希望他们都能将trafic重定向到www.web1.com

问题是,我在网站上使用joomla,因此99%的时间人们都应该进入类似“www.web1.com.ar/index.php/stuff/morestuff/something.html”这样的URL

我不想丢失人们制作的任何书签,或我在facebook上的链接


我一直在搜索并试图理解这应该如何编码,但到目前为止我没有运气。

在根目录中找到的.htaccess文件中,如果没有,请将htaccess.txt重命名为.htaccess,然后在第30行左右,您应该会找到以下内容:

##  Can be commented out if causes errors, see notes above.
Options +FollowSymLinks

#
#  mod_rewrite in use

RewriteEngine On
然后把这个加在下面

RewriteCond %{HTTP_HOST} ^web1.com$
RewriteRule ^/?$ "http\:\/\/www\.web1\.com" [R=301,L]

RewriteCond %{HTTP_HOST} ^web1.com.ar$ [OR]
RewriteCond %{HTTP_HOST} ^www.web1.com.ar$
RewriteRule ^/?$ "http\:\/\/www\.web1\.com" [R=301,L]
你的链接仍然有效,但如果有任何链接指向直接url,它们将被重定向

您还可以在configuration.php中查找以下行:

var $live_site = '';
换成

var $live_site = 'http://www.web1.com';

通过
httpd.conf
启用mod_rewrite和.htaccess,然后将此代码放入
文档根目录下的
.htaccess

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^((www\.)?web1\.com\.ar|web1\.com)$ [NC]
RewriteRule ^ http://www.web1.com%{REQUEST_URI} [R=301,L]