htaccess的RewriteEngine叙述 [英] htaccess RewriteEngine

查看:185
本文介绍了htaccess的RewriteEngine叙述的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网址是 http://www.urlbookmarking.com/书签-details.php?出价= 55 我希望它像 http://www.urlbookmarking.com/bookmark/55

I have an url which is http://www.urlbookmarking.com/bookmarks-details.php?bid=55 and I want it to be like http://www.urlbookmarking.com/bookmark/55

我写在我的htaccess的:

I wrote in my htaccess:

RewriteEngine on
RewriteRule /bid/(.*) bookmarks-details.php?bid=$1

但是,当我去的第一个URL重写引擎不适用我的规则。是否有任何错误或冲突的地方?

But when I go to the first URL the rewrite engine does not apply my rule. Is there any mistake, or conflict somewhere?

我写为全htaccess文件如下

My full htaccess file written as follows

Options +FollowSymLinks

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L] 

RewriteEngine on
RewriteCond %{HTTP_HOST} ^urlbookmarking.com [NC]
RewriteRule ^(.*)$ http://www.urlbookmarking.com/$1 [L,R=301]

RewriteEngine on
RewriteRule /bid/(.*) bookmarks-details.php?bid=$1

请帮我。

推荐答案

选项+了FollowSymLinks 是可选的,如果已经配置中的的httpd.conf

The line Options +FollowSymLinks is optional if already configured in httpd.conf

Options +FollowSymLinks

RewriteEngine on

RewriteCond %{HTTP_HOST} ^urlbookmarking\.com [NC]
RewriteRule ^(.*)$ http://www.urlbookmarking.com/$1 [R=301, L]

RewriteRule ^bookmark/([0-9]+)$ bookmarks-details.php?bid=$1 [NC, L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

这篇关于htaccess的RewriteEngine叙述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆