开发者

How would I write a RewriteRule to make redirection

开发者 https://www.devze.com 2023-01-22 02:41 出处:网络
I want to rewrite the html and xml files and directories to the pagename query string using .htaccess file. like this :

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

精彩评论

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