htaccess的假文件夹文件夹、htaccess

2023-09-02 01:09:18 作者:妳的愛很虛僞

我有一个网站,你可以创建一个网络,但我有一个问题,以创建一个假的文件夹。

I have a site which you can create a network but I have a problem to create a fake folder.

正常的URL;

mysite.com/profile.php?id=123&network=stackoverflow

我要的是

mysite.com/stackoverflow/profile.php?id=123

另一个例子

正常的URL;

mysite.com/home.php?network=stackoverflow

我要的是

mysite.com/stackoverflow/home.php

什么是htaccess的code这个? 感谢您的帮助

What is the htaccess code for this? Thanks for your help

推荐答案

试试这个:

RewriteRule ^([^/]+)/(.*)$ /$2?network=$1 [QSA,L]

这将采取

yoursite.com/anything_up_to_the_slash/anything.php?anything=anything

和它重写

yoursite.com/anything.php?anything=anything&network=anything_up_to_the_slash