简体   繁体   English

htaccess mod重写斜杠问题

[英]htaccess mod rewrite slash issue

I managed to rewrite mydomain.com/file.php?id=## to this: 我设法将mydomain.com/file.php?id=##重写为此:

mydomain.com/##-Report_TITLE_OF_REPORT_HERE mydomain.com/##-Report_TITLE_OF_REPORT_HERE

by letting the .htaccess just take the ## and ignore anything that comes after it. 通过让.htaccess只是采用##而忽略其后的所有内容。 I would like to change it to this: 我想将其更改为:

mydomain.com/report-##/TITLE_OF_REPORT_HERE mydomain.com/report-##/TITLE_OF_REPORT_HERE

However I cannot manage to wrap my head around it nor can I find any tutorial for this specific case online. 但是,我无法设法解决这个问题,也无法在线找到针对该特定案例的任何教程。 The slash in the middle seems to muck everything up. 中间的斜线似乎使一切都糟透了。

Could anyone tell me how to do this? 谁能告诉我该怎么做?

尝试这个:

RewriteRule ^report-(.*)/(.*)$ mydomain.com/file.php?id=$1 [L]

You can use this code: 您可以使用以下代码:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteRule ^report-([^/]+)/ file.php?id=$1 [L,NC,QSA]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM