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

时间:2010-07-16 07:27:08

标签: php url mod-rewrite rewrite rule

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

选项+ FollowSymLinks RewriteEngine on RewriteRule ^预订/价格/([0-9] +)/?$ booking.php?价格= $ 1

解决方案是什么?

2 个答案:

答案 0 :(得分:1)

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。

答案 1 :(得分:-1)

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

对于images和Css,你需要在htaccess文件中定义你的基本文件夹  RewriteBase /〜你的文件夹/

相关问题