.htaccess通过url参数重定向

时间:2016-07-22 13:00:38

标签: apache .htaccess mod-rewrite nginx

有nginx服务器的设置:

location ~* ^/([a-z][a-z])-([a-z][a-z])/(.*) {
    set $args $args&COUNTRY=$1&LANGUAGE=$2;
    rewrite ^/([a-z][a-z])-([a-z][a-z])/(.*) / break;
    resolver        127.0.0.1;
    proxy_pass http://127.0.0.1/$3$is_args$args;
    proxy_redirect off;
    proxy_set_header Host $host;
}

适用于nginx。 所有页面均为http://localdomain.com/ - / about / open as localdomain.com/about/此页面。在url我有localdomain.com/en-en/about/ - 这就是我需要的。

但它在apache中不起作用。 如何在.htaccess文件中使用apache进行修改?

RewriteCond %{REQUEST_FILENAME} ^\/([a-z][a-z])-([a-z][a-z])\/(.*)$
 RewriteRule ^([a-z][a-z])-([a-z][a-z])/(.*)$ http://localdomain.com/$3?COUNTRY=$1&LANGUAGE=$2 [R=301,L]

它不起作用。

0 个答案:

没有答案
相关问题