使用.htaccess重定向

使用.htaccess重定向,.htaccess,http-redirect,url-redirection,.htaccess,Http Redirect,Url Redirection,我想从一个域重定向到另一个域 像 对此 www.myanotherdomain.com/index.php?c=abc&s=def&p=ghi.html 有人能解决这个问题吗?此规则只接受带有3个参数(不少于,不多于)的URL。 每一个都可以包含数字、字母和-(换句话说:[a-zA-Z0-9.-]) 您可以修改此htaccess以允许1、2或3个参数: RewriteEngine On RewriteBase / RewriteRule ^([\w-]+)\.html$ htt

我想从一个域重定向到另一个域 像

对此

www.myanotherdomain.com/index.php?c=abc&s=def&p=ghi.html

有人能解决这个问题吗?

此规则只接受带有3个参数(不少于,不多于)的URL。
每一个都可以包含数字、字母和
-
(换句话说:
[a-zA-Z0-9.-]

您可以修改此htaccess以允许1、2或3个参数:

RewriteEngine On
RewriteBase /
RewriteRule ^([\w-]+)\.html$ http://myanotherdomain.com/index.php?c=$1 [L,R=301]
RewriteRule ^([\w-]+)/([\w-]+)\.html$ http://myanotherdomain.com/index.php?c=$1&s=$2 [L,R=301]
RewriteRule ^([\w-]+)/([\w-]+)/([\w-]+)\.html$ http://myanotherdomain.com/index.php?c=$1&s=$2&p=$3 [L,R=301]
RewriteEngine On
RewriteBase /
RewriteRule ^([\w-]+)/([\w-]+)/([\w-]+)\.html$ http://myanotherdomain.com/index.php?c=$1&s=$2&p=$3 [L,R=301]
RewriteEngine On
RewriteBase /
RewriteRule ^([\w-]+)\.html$ http://myanotherdomain.com/index.php?c=$1 [L,R=301]
RewriteRule ^([\w-]+)/([\w-]+)\.html$ http://myanotherdomain.com/index.php?c=$1&s=$2 [L,R=301]
RewriteRule ^([\w-]+)/([\w-]+)/([\w-]+)\.html$ http://myanotherdomain.com/index.php?c=$1&s=$2&p=$3 [L,R=301]