2015-10-05 128 views
-1

noob here。我如何重定向:將動態網站URL重定向到其動態子域URL

編輯:

http://domain.com/members/index.php/register/params?item=1&pname=productname&pid=1289465219 

http://members.domain.com/index.php/register/params?item=1&pname=productname&pid=1289465219 

與htaccess的?

其中「item」,「pname」和「pid」變量是動態的。

+0

重寫使用正則表達式。 「動態」僅僅意味着「在這裏使用通配符」。 –

+0

hello @MarcB。就像我剛纔提到的那樣,我是新手(不太熟悉htaccess /重寫世界)。我只是希望你們中的某個人能夠給我更直接的回答,因爲我的這項任務的時間有限:( - 感謝你的回覆。 – Victor

回答

0

嘗試在你的文檔根目錄添加這htaccess的文件:

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC] 
RewriteCond %{QUERY_STRING} (^|&)item= 
RewriteCond %{QUERY_STRING} (^|&)pname= 
RewriteCond %{QUERY_STRING} (^|&)pid= 
RewriteRule ^index\.php/register/params$ http://subdomain.domain.com/index.php/register/params [L,R] 
+0

對不起,我更新了我的問題。@Jon Lin會爲你解答仍然適用@喬恩從林,但 – Victor

+0

細微變化不工作 'RewriteEngine敘述在 的RewriteCond%{HTTP_HOST}^teamaster \ .COM /會員/ $ [NC] 的RewriteCond%{QUERY_STRING}?(^ |&)項= RewriteCond%{QUERY_STRING}(^ |&)cname = RewriteCond%{QUERY_STRING}(^ |&)cemail = RewriteCond%{QUERY_STRING}(^ |&)ccountry = RewriteRule^index \ .php/register/CUVow3 $ http://members.teamaster.com/index.php/register/CUVow3 [L,R]' - 對不起我的評論,反引用似乎不適用於代碼 – Victor

+0

任何人都可以:( – Victor