简体   繁体   English

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

[英]URL Rewriting-Page display - rewrite rule in .htaccess

For URL Rewriting, i have got the output for static URL But , for dynamic URL , i am getting partial output only. 对于URL重写,我得到了静态URL的输出,但是对于动态URL,我只得到了部分输出。 I have placed the .htaccess file in the root directory only. 我只将.htaccess文件放在根目录中。 Here is the code: 这是代码:

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

What will be the solution ? 有什么解决方案?

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. 不过,您确实确实想为这些代码自定义代码,以便能够使用常规规则,而不是将特定路径转换为使用$ _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 在RewriteRule ^ booking /([[0-9] +)/?$ booking.php?price = $ 1 RewriteRule ^ booking /([0-9] +)/([0-9] +)/上的选项+ FollowSymLinks RewriteEngine $ booking.php?price = $ 1&pass = $ 2

For images and Css you need to define your base folder in htaccess file as RewriteBase /~your folder/ 对于图像和CSS,您需要在htaccess文件中将基本文件夹定义为RewriteBase /〜您的文件夹/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM