我很难重新改写,希望有人知道答案。
这是我目前在.htaccess中使用的代码:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /point/to/dir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(\d+/.*)$ https://domain.ext/point/to/dir/module/status.php?id=$1 [L,QSA]客户端从服务器请求domain.ext/point/ to /dir/,应该将其重写到https://domain.ext/point/to/dir/module/status.php。
有可能将查询添加到/point/ to /dir/请求的末尾,该请求应该附加到https://domain.ext/point/to/dir/module/status.php。/point/to/dir/是服务器上不存在的位置。
不管我做什么,我都会得到内部服务器错误(不正确的.htaccess配置/语法)或404。希望有人能帮忙。
发布于 2021-07-13 08:28:42
在显示的示例中,以下列方式保存htaccess规则文件。确保您将路径从point/to/dir更改为实际路径(不要将/放在前面,否则不起作用)。
这是假设您的点/do/dir在模块文件夹中也有模块文件夹和index.php。
在测试URL之前,一定要清除浏览器缓存。
Options +FollowSymLinks
RewriteEngine on
RewriteBase /point/to/dir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(point/to/dir)/(.*)/?$ https://domain.ext/$1/module/status.php?id=$2 [NC,L,QSA]或,如果您是在同一个域名,那么您就不必在重写的权利部分提到完整的url,然后按下面的方式进行,确保要么使用以上的规则,要么一次只使用一个规则。
Options +FollowSymLinks
RewriteEngine on
RewriteBase /point/to/dir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(point/to/dir)/(.*)/?$ $1/module/status.php?id=$2 [NC,L,QSA]https://stackoverflow.com/questions/68358903
复制相似问题