如何在 .htaccess 的帮助下使用网址重写来更改网址
以下是网址
FROM:
http://www.test.xyz.com/ab/web/pds/dispall/web/web-design
TO:
http://www.web.test.xyz.com/ab/web/pds/dispall/web-design
我想将第五个(第五个)参数用作子域。
谢谢!
答案 0 :(得分:2)
将此代码放入DOCUMENT_ROOT/.htaccess
文件中:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.test\.xyz\.com$ [NC]
RewriteCond %{REQUEST_URI} /pds/
RewriteRule ^[^/]+/[^/]+/[^/]+/[^/]+/([^/]+)/.*$ http://www.$1.test.xyz.com%{REQUEST_URI} [NE,R=301,L]