URL重写-页面显示-.htaccess中的重写规则
对于 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您确实希望针对这些自定义代码,以便能够使用通用规则,而不是转换特定路径以使用 $_GET。
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.
选项+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/