URL重写-页面显示-.htaccess中的重写规则

发布于 2024-09-09 09:11:53 字数 200 浏览 3 评论 0原文

对于 URL 重写,我得到了静态 URL 的输出 但是,对于动态 URL,我只得到部分输出。 我仅将 .htaccess 文件放在根目录中。 这是代码:

Options +FollowSymLinks 重写引擎开启 RewriteRule ^booking/price/([0-9]+)/?$ booking.php?price=$1

解决方案是什么?

For URL Rewriting, i have got the output for static URL
But , for dynamic URL , i am getting partial output only.
I have placed the .htaccess file in the root directory only.
Here is the code:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^booking/price/([0-9]+)/?$ booking.php?price=$1

What will be the solution ?

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

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

发布评论

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

评论(2

寄居者 2024-09-16 09:11:53
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^booking/([0-9]+)/?$ booking.php?price=$1
RewriteRule ^booking/([0-9]+)/([0-9]+)/?$ booking.php?price=$1&pass=$2

您确实希望针对这些自定义代码,以便能够使用通用规则,而不是转换特定路径以使用 $_GET。

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^booking/([0-9]+)/?$ booking.php?price=$1
RewriteRule ^booking/([0-9]+)/([0-9]+)/?$ booking.php?price=$1&pass=$2

You really want to customise your code for these though so as to be able to use general rules, rather than converting specific paths to use $_GET.

物价感观 2024-09-16 09:11:53

选项+FollowSymLinks
重写引擎开启
RewriteRule ^booking/([0-9]+)/?$ booking.php?price=$1
RewriteRule ^booking/([0-9]+)/([0-9]+)/?$ booking.php?price=$1&pass=$2

对于图像和 CSS,您需要在 htaccess 文件中定义基本文件夹作为
RewriteBase /~你的文件夹/

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^booking/([0-9]+)/?$ booking.php?price=$1
RewriteRule ^booking/([0-9]+)/([0-9]+)/?$ booking.php?price=$1&pass=$2

For images and Css you need to define your base folder in htaccess file as
RewriteBase /~your folder/

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