htaccess将特定域的特定页面重定向到特定页面

时间:2014-02-13 09:28:25

标签: wordpress .htaccess redirect domain-mapping

我们运行了Wordpress Mutlisite,因此只有在请求特定域时才需要重定向特定的页面,类别和文件。

因此,当domain.de/allgemein被请求时,它应该重定向到domain.de/neues-von-der-domain,但是如果例如domain2.de/allgemein是请求,则不。

我们使用域映射,因此所有域只有一个htaccess文件。

RewriteEngine On

RewriteCond %{HTTP_HOST} ^domain.de$ [NC]    
RewriteCond %{REQUEST_URI} !^/allgemein    
RewriteRule domain.de/neues-von-der-domain/ [NC,L,R=301]

2 个答案:

答案 0 :(得分:1)

RewriteEngine On

    RewriteCond %{HTTP_HOST} ^(www\.)?yourdomain\.com [NC]
    RewriteRule ^(.*)$ http://otherdomain.com/$1 [R=301,L]

还可以用于根据请求的域重定向到目标网页:

RewriteEngine On

    RewriteCond %{HTTP_HOST} ^www.domain.com
    Rewriterule ^(.*)$ http://www.any-domain.com/landing-page.html [L]

答案 1 :(得分:0)

enter code here  <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>

将此代码放入.htaccess文件

相关问题