双重重定向

发布于 2024-12-09 17:18:23 字数 765 浏览 0 评论 0原文

您好,我有一个网站,它对隐藏 url 的页面处理脚本进行 url 重写

#Direct to pageprocessor
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ pageprocessor.php?url=$1/

,然后将 url 传递到该网站,例如 http://domain.com/this/that 然后页面处理器告诉站点要显示什么。欢呼!

我的问题是,我需要添加进一步的重写,首先转到页面处理器,然后将 / 添加到给定的 url,因为用户将链接到网站等,而无需尾随 /

它需要执行 301 重定向到给定的url + /(如果不存在)。

我所有的尝试都使重定向使用传递给 pageprocessor 的 url,即

http://domain.com/this/that< /a> 变为 http://domain.com/this/pageprocessor.php?url=希望

这足够清楚很难解释:D 提前欢呼

Hi I have a site that does an url rewrite to a page processing script hiding the url

#Direct to pageprocessor
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ pageprocessor.php?url=$1/

then urls are passed to the site as such http://domain.com/this/that
page processor then tells the site what to display. hurrah!

my problem is that I need to add further rewrite to first go to page processor as it does but then add a / to the given url, as users will link to the site etc without the trailing /

it needs to do a 301 redirect to given url + / if one isn't present.

all my attempts has the redirect use the url that is passed to pageprocessor ie

http://domain.com/this/that becomes http://domain.com/this/pageprocessor.php?url=that/

hope this is clear enough is hard to explain :D
cheers in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

日暮斜阳 2024-12-16 17:18:23

我希望这会有所帮助

RewriteEngine On
RewriteBase /path/of/folder/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !example.php
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ /path/of/folder/$1/ [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /path/of/folder/index.php?url=$1

I hope this may help

RewriteEngine On
RewriteBase /path/of/folder/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !example.php
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ /path/of/folder/$1/ [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /path/of/folder/index.php?url=$1
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文