简体   繁体   中英

mod_rewrite rewrite url using .htaccess php

I am new to htaccess rules.

I want a rule that will treat two urls as one.

This two should be treated as same URL. I just want to add sites/client1 to URL which actually does nothing. Every URL request should contain sites/client1/.

For next request like

  • multisite2/index.php?id_product=1&controller=product
  • multisite2/sites/client1/index.php?id_product=1&controller=product

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 url rewrite to .php

This will send all request in /sites/client1/ to /

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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