简体   繁体   中英

htaccess to redirect to a different site with a query

Hello I am trying to redirect: http://example.com/sz/QUERY to: http://differentsite.com/?q=sea:r.ch QUERY

I am having trouble with adding the space in the above link...

Here is what I got so far in root/sz/ :

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://differentsite.com/?q=sea:r.ch%20$1 [L,QSA]

Any help would be appreciated.

You can use this rule:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^sz/(.+)$ "http://differentsite.com/?q=sea:r.ch $1" [L,QSA,NE,R]

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