将值传递给 htaccess

发布于 2024-09-10 03:52:00 字数 271 浏览 2 评论 0原文

我有一个用于重定向的 htaccess 文件,

重定向的内容是

RewriteCond %{REQUEST_FILENAME} -location&action=photos&page=$
RewriteRule ^(.*)$ /sitename/view.php?link=$1&action=photos&page=&1
 [L,QSA]

页面编号是从页面动态传递的 我们如何在这里获取页码请帮助我

i have a htaccess file for redirection

the redirected content is

RewriteCond %{REQUEST_FILENAME} -location&action=photos&page=$
RewriteRule ^(.*)$ /sitename/view.php?link=$1&action=photos&page=&1
 [L,QSA]

The page numer is dynamically passing from the page
How we can get the page number here pls helpme

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

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

发布评论

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

评论(1

枉心 2024-09-17 03:52:00

回答您的标题:您无法将值传递给 .htaccess 文件。

不过,如果对您有帮助,您可以通过脚本生成 .htaccess 文件。

关于您的示例代码,也许这就是您想要实现的目标:

RewriteCond %{REQUEST_FILENAME} -location&action=photos&page=$
RewriteRule ^(.*)&page=(.*)$ /sitename/view.php?link=$1&action=photos&page=$2
 [L,QSA]

使用它您可以通过 $1 访问链接,通过 $2 访问页面

To answer your headline: You cannot pass values to a .htaccess file.

You can however generate the .htaccess file by a script, if that helps you.

Regarding your sample code, maybe this is what you like to achieve:

RewriteCond %{REQUEST_FILENAME} -location&action=photos&page=$
RewriteRule ^(.*)&page=(.*)$ /sitename/view.php?link=$1&action=photos&page=$2
 [L,QSA]

Using this you can access the link via $1 and the page via $2

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文