2013-03-21 59 views

回答

0

應該

Redirect 301 /folder1/nisanth.php?id=(.*) http://www.domain.com/folder2/nisanth.php?id=$1 
+0

仍位於folder1 – 2013-03-21 08:55:49

0

這應該幫助你

RewriteEngine on 
RewriteRule ^/folder1/nisanth.php?id=(.*)$ /folder2/nisanth.php?id=$1 [L,R=301] 
0

我想重定向

http://domain.com/folder1/nisanth.php?id=1

http://domain.com/folder2/nisanth.php?id=1

我該如何編寫我的htaccess行?我試着用

重定向301 /folder1/nisanth.php?id=$1 /folder2/nisanth.php?id=$1


Redirect是mod_alias中的指令不恰當的操作查詢字符串:

mod_alias旨在處理簡單的URL操作任務。對於更復雜的任務(如操作查詢字符串),請使用mod_rewrite提供的工具。

Apache mod_alias docs

所以提取出來,應使用mod_rewrite的。在根目錄下一個.htaccess文件同樣的例子是這樣的:

Options +FollowSymLinks -MultiViews 
RewriteEngine On 
RewriteBase/
RewriteCond %{REQUEST_URI} !/folder2/nisanth\.php  [NC] 
RewriteRule ^folder1/nisanth\.php /folder2/nisanth.php [R=301,NC,L] 

永久重定向:

http://domain.com/folder1/nisanth.php?id=anything

要:

http://domain.com/folder2/nisanth.php?id=anything

查詢id =任何東西被認爲是動態的並被追加自動到腳本。

對於無提示映射,請將[R,301,NC,L]替換爲[NC,L]