目前目的达到的代码
RewriteEngine OnRewriteCond %{HTTP_HOST} ^sell-meihualu.abc.com$ [NC]RewriteRule (.*) http://www\.abc\.com/sell/meihualu/$1 [R=301,NC,L]
你那是 301 跳转,不是伪静态
跳转后 url 就变了
这是我用的
RewriteCond %{HTTP_HOST} ^([^\.]+).tool.net$
RewriteRule ^(/?)(.*)$ /users/%1/$2 [PT,L]
令形如 blog.tool.net/index.php 的 url 定位到 users/blog/index.php
url 不变
同理,你的规则写作这样就可以了
RewriteCond %{HTTP_HOST} ^([a-z]+)-([a-z]+).abc.com$ [NC]
RewriteRule (.*) http://www\.abc\.com/%1/%2/$1 [R=301,NC,L]
不会只有 sell-meihualu.abc.com 这样一个二级域名吧?
感谢版主大大的回复。。
确实不止一条,单条的话 我会写死!
你那是 301 跳转,不是伪静态
跳转后 url 就变了
这是我用的
RewriteCond %{HTTP_HOST} ^([^\.]+).tool.net$
RewriteRule ^(/?)(.*)$ /users/%1/$2 [PT,L]
令形如 blog.tool.net/index.php 的 url 定位到 users/blog/index.php
url 不变
同理,你的规则写作这样就可以了
RewriteCond %{HTTP_HOST} ^([a-z]+)-([a-z]+).abc.com$ [NC]
RewriteRule (.*) http://www\.abc\.com/%1/%2/$1 [R=301,NC,L]
不会只有 sell-meihualu.abc.com 这样一个二级域名吧?
# Protect httpd.ini and httpd.parse.errors files# from accessing through HTTPRewriteCond Host: ([a-z0-9]+)-([a-z0-9]+)\.abc\.comRewriteRule (.*) http://www\.abc\.com/$1/$2/$3 [I,RP]
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号