2010-10-25 166 views
0

我想使用.htaccess文件將html和xml文件和目錄重寫爲pagename查詢字符串。是這樣的:我該如何編寫一個RewriteRule來重定向

mysubsite/category_1/category_2/ mysubsite/category_1/category_2 /的file1.html mysubsite/category_1/category_2/file2.152.html

的index.php頁面名= category_1/category_2/ index.php?pagename = category_1/category_2/file1.html index.php?pagename = category_1/category_2/file1.152.html

感謝您的幫助。

回答

0

你有

mysubsite/category_1/category_2/mysubsite/category_1/category_2 /的file1.html mysubsite/category_1/category_2/file2.152.html

的index.php?頁面名??= category_1/category_2/index.php的頁面名稱= category_1/category_2/index.php的的file1.html頁面名= category_1/category_2/file1.152.html

而且我假設你的意思是:

mysubsite/category_1/category_2/

mysubsite/category_1/category_2 /的file1.html

mysubsite/category_1/category_2/file2.152.html

的index.php?頁面名= category_1/category_2/

的index.php?頁面名= category_1/category_2 /的file1.html

index.php?pagename = category_1/category_2/file1.152.html

<IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteRule ^mysubsite/(.*) index.php?q=$1 [NC,L,QSA] 
</IfModule>