mod_rewrite的,的.htaccess连接到MySQL数据库连接到、数据库、mod_rewrite、htaccess

2023-09-02 00:42:42 作者:柠檬之夏

我想了mod_rewrite的.htaccess文件链接到一个MySQL数据库为我提供的映射信息。

I would like mod_rewrite in an .htaccess file to link to a mysql database to provide me with mapping information.

具体而言,我使用的是单一的code基地so..if用户请求的图像,例如承载多个站点: https://m.xsw88.com/allimgs/daicuo/20230902/221.png.jpg

Specifically, I am using a single code base to host multiple sites so..if a user requests an image, for example: https://m.xsw88.com/allimgs/daicuo/20230902/221.png.jpg

这是要砸我的服务器和许多其他网站也将被打的/ images文件夹,所以我需要Apache与回复: /home/example/pubic_html/images/7383/car.jpg

this is going to hit my server and many other sites will also be hitting that /images folder, so I need Apache to reply with: /home/example/pubic_html/images/7383/car.jpg

注意在注射的7383,这是一个例子网站ID为该用户

Notice the injection of "7383" which is an example site id for that user.

基本上,我想使用MySQL数据库之间example.com和7383映射,然后得到正确的文件给用户。

Basically, I want to map between example.com and 7383 using the mysql database and then get the correct file to the user.

任何想法?

推荐答案

您可以使用脚本作为的重写地图得到真实路径。

You could use a script as a rewrite map to get the real path.