2012-02-01 86 views
0

我需要知道如何創建如下因素的規則在同一個.htaccess文件:的Apache的.htaccess文件夾重定向規則

  1. 重定向從example.com/stexample.com
  2. example.com/[ANY STRING]重定向到new-example.com/[ANY STRING]

問題是我需要按原樣發送查詢字符串。

回答

0

你的問題不是很清楚,但你可以在你的.htaccess文件試試這個代碼:

Options +FollowSymLinks -MultiViews 
RewriteEngine on 

# your first requirement 
RewriteRule ^st/?$/[L] 

# your second requirement; it will also append existing query string 
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC] 
RewriteRule^http://new-example.com%{REQUEST_URI} [L,R=301]