简体   繁体   English

将Mod_Rewrite与URL中的额外斜杠一起使用

[英]Using Mod_Rewrite with extra slashes in URL

At /corner.php I have a script which adds rounded corners to an image. 在/corner.php,我有一个脚本,可以在图像上添加圆角。 I'm using Mod_Rewrite to rewrite my site urls. 我正在使用Mod_Rewrite重写我的网站网址。

I want to be able to go to http://domain.com/corner/templates/Toys/images/no_image.gif and it will actually send me to /corner.php?source=templates/Toys/images/no_image.gif. 我希望能够转到http://domain.com/corner/templates/Toys/images/no_image.gif ,它实际上会将我发送到/corner.php?source=templates/Toys/images/no_image.gif 。

But because there are extra slashes in the url, it isn't working. 但是因为URL中有多余的斜杠,所以它不起作用。 Is there a way to do this. 有没有办法做到这一点。

I don't see any extra slashes which can disrupt mode rewrite. 我看不到任何多余的斜杠,可以打乱模式重写。

This should work, also being in the same domain you don't have to specify it 这应该可行,并且也位于您不必指定的同一个域中

RewriteEngine on
RewriteRule ^corner\/(.*)$       /corner.php?source=$1

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

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