子域重写的.htaccess

编程入门 行业动态 更新时间:2024-10-28 07:18:55
本文介绍了子域重写的.htaccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的这些规则,一切工作好。

I have these rules, everything work good.

我只需要添加此规则:

从it.domain/index.php?city=newyork到it.domain/product-usa-newyork~~V

from it.domain/index.php?city=newyork to it.domain/product-usa-newyork

唯一的变化是纽约。它也可以:lasvegas等。

The only thing that change is "newyork". It can be also: lasvegas etc..

推荐答案

试试你现有的规则之前插入这条规则的

Try inserting these 2 rules before your existing rules:

#Rewrite from it.domain/index.php?city=dc to it.domain/product-usa-dc RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTP_HOST} ^[^.]+\.domain\$ [NC] RewriteCond %{THE_REQUEST} \s/+index\.php\?city=([^\s&]+) [NC] RewriteRule ^ /product-usa-%1? [R=302,L] RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTP_HOST} ^[^.]+\.domain\$ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^product-usa-([^/]+)/?$ /index.php?city=$1 [L,QSA,NC]

更多推荐

子域重写的.htaccess

本文发布于:2023-10-31 17:31:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546782.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重写   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!