对于 URL 重写,我得到了静态 URL 的输出但是,对于动态 URL,我只得到部分输出。我只将 .htaccess 文件放在根目录中。这是代码:
选项 +FollowSymLinks RewriteEngine on RewriteRule ^booking/price/([0-9]+)/?$ booking.php?price=$1
解决方案是什么?
对于 URL 重写,我得到了静态 URL 的输出但是,对于动态 URL,我只得到部分输出。我只将 .htaccess 文件放在根目录中。这是代码:
选项 +FollowSymLinks RewriteEngine on RewriteRule ^booking/price/([0-9]+)/?$ booking.php?price=$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。
选项 +FollowSymLinks RewriteEngine on RewriteRule ^booking/([0-9]+)/?$ booking.php?price=$1 RewriteRule ^booking/([0-9]+)/([0-9]+)/? $ booking.php?price=$1&pass=$2
对于图像和 Css,您需要在 htaccess 文件中将基本文件夹定义为 RewriteBase /~your folder/