简体   繁体   English

使用.htaccess php mod_rewrite重写URL

[英]mod_rewrite rewrite url using .htaccess php

I am new to htaccess rules. 我是htaccess规则的新手。

I want a rule that will treat two urls as one. 我想要一个将两个URL视为一个的规则。

This two should be treated as same URL. 这两个应视为相同的URL。 I just want to add sites/client1 to URL which actually does nothing. 我只想将站点/ client1添加到实际上不起作用的URL。 Every URL request should contain sites/client1/. 每个URL请求应包含site / client1 /。

For next request like 对于下一个要求

  • multisite2/index.php?id_product=1&controller=product multisite2 /的index.php?id_product = 1&控制器=产品
  • multisite2/sites/client1/index.php?id_product=1&controller=product multisite2 /站点/客户端1 /的index.php?id_product = 1&控制器=产品

Thanks for any help. 谢谢你的帮助。

Try this: 尝试这个:

RewriteRule index.php?(.*) sites/client1/index.php?$1

Also please search around a bit before posting here. 另外,在此处发布之前,请先进行搜索。 Some possible duplicates of this question are these: 这些问题的一些可能重复项是:

.htaccess URL rewrite with one and two query string vars .htaccess用一个和两个查询字符串var重写的URL

htaccess url rewrite to .php htaccess url重写为.php

This will send all request in /sites/client1/ to / 这会将/ sites / client1 /中的所有请求发送到/

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^sites/client1/(.*)$ $1 [L,QSA]
</IfModule>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM