重定向/媒体/ *到/项目/媒体/ *和其他一切/dispatch.php媒体、重定向、项目、php

2023-09-02 01:13:57 作者:执幂不悟

我有以下重写规则:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /

  # Route requests to /media/* to /projects/media/*
  RewriteRule ^media/.* - [NC,L]

  # Route all URLs to dispatch.php.
  RewriteRule ^(.*)$ dispatch.php [L]
</IfModule>

这重定向一切dispatch.php,除非该网址是 example.com/media / * 在这种情况下,它会寻找在所需的文件 ./媒体/ 。我想网址 /媒体/ * 来改写看在项目/媒体/ *

This redirects everything to dispatch.php, unless the URL is example.com/media/* in which case it will look for the requested file in ./media/. I would like the URL /media/* to be rewritten to look in project/media/*.

使用重写规则重写规则^媒体/.*项目/媒体[NC,L] 的结果都将dispatch.php。

Using the rewrite rule RewriteRule ^media/.* project/media [NC,L] results in everything going to dispatch.php.

推荐答案

办法可以解决here.