【发布时间】:2021-09-22 07:13:33
【问题描述】:
我在设置重写时遇到问题,希望有人知道答案。
这是我目前在 .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 错误。希望有人能帮忙。
【问题讨论】:
-
欢迎来到 SO,感谢您在问题中添加您的努力。关于
It is possible that a query is added to the end of the /point/to/dir/ request, which should be appended to https://domain.ext/point/to/dir/module/status.php. The /point/to/dir/ is a non-existing location on the server.,请务必提及您要在您的网址中添加哪个查询字符串? -
我很抱歉。我的知识非常有限。任何东西都可以添加到 /point/to/dir/? .反斜杠 (dir/*) 之后的任何内容都应附加到 php*。
标签: apache .htaccess mod-rewrite url-rewriting directadmin