重定向方式为.htaccess不';行不通

重定向方式为.htaccess不';行不通,.htaccess,redirect,joomla,.htaccess,Redirect,Joomla,我希望URL www.michelenna.nl被重定向到www.michelenna.nl/wycliffe 实际Joomla路径为/wycliffe= 因此,我认为:在.htaccess中的以下几行应该是合适的,但它不起作用。www.michelenna.nl仍然指向www.michelenna.nl 代码如下: Options SymlinksIfOwnerMatch RewriteEngine On RewriteCond %{HTTP_HOST} ^www.michelenerna.

我希望URL www.michelenna.nl被重定向到www.michelenna.nl/wycliffe

实际Joomla路径为/wycliffe=

因此,我认为:在.htaccess中的以下几行应该是合适的,但它不起作用。www.michelenna.nl仍然指向www.michelenna.nl

代码如下:

Options SymlinksIfOwnerMatch
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.michelenerna.nl [NC]
RewriteRule ^article(.*)$ http://www.michelenerna.nl/index.php?option=com_content&view=article&id=97&Itemid=249/$1 [R=301,L]

为什么不起作用

尝试使用以下选项:

RewriteCond %{HTTP_HOST} ^(www.)?michelenerna.nl$ [NC]
RewriteRule ^(/)?$ wycliffe/index.php [L]

您也可以在您的服务器cPanel中实现这一点,方法是转到“重定向”页面并选择适用于您的选项。

以下内容适用于我:

RewriteCond %{HTTP_HOST} ^(www.)?michelenerna.nl$
RewriteRule ^(/)?$ wycliffe [L]

你有访问cPanel的权限吗?没有,我得到一个无限循环,因为你重定向到另一篇文章,但指向同一个index.php。如果
wycliffe
root
文件夹下的有效文件夹,它就可以工作。我已经用过几次了!关于无限循环-只有在某个地方执行另一个重定向时才会发生:在
.htaccess
index.php
中不,因为“wycliffe”不是文件夹。我使用的是joomla,它处理文章,然后使用1 index.php。您的另一个解决方案也不起作用,因为www.michelenna.nl是www.jmpaw.nl的别名,我只希望www.michelenna.nl指向www.michelenna.nl/wycliffe,而www.jmpaw.nl仍然指向www.jmpaw.nl注意:正则表达式中未包含在字符类中的任何点
[]
或前面有反斜杠的字符被视为“通配符”(任何非换行符)。这是一个很好的习惯,逃避点,使他们字面上-即使它不影响这种情况。