.htaccess将URL重定向到文件夹

时间:2013-12-16 09:57:52

标签: regex apache .htaccess mod-rewrite

我需要Apache .htaccess的帮助 我想将www.abc.com.au/folder1/folder2/file.php?pi=xyz重定向到以下内容: www.abc.com.au/folder1/xyz/folder 2/

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

将此代码放入DOCUMENT_ROOT/.htaccess文件中:

RewriteEngine On

RewriteRule ^(folder1)/([^/]+)/([^/]+)/?$ /$1/$3/file.php?pi=$2 [L,NC,QSA,NE]