开发者

How would I write a RewriteRule to make redirection

I want to rewrite the html and xml files and directories to the pagename query string using .htaccess file. like this :

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

开发者_开发百科

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

Thanks for you help.


You have

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

and

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

And I'm supposing that you meant:

mysubsite/category_1/category_2/

mysubsite/category_1/category_2/file1.html

mysubsite/category_1/category_2/file2.152.html

and

index.php?pagename=category_1/category_2/

index.php?pagename=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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜