htaccess规则。请高手帮写一下。多谢

WBOY
發布: 2016-06-13 13:47:51
原創
826 人瀏覽過

求一个htaccess规则。请高手帮写一下。谢谢
求一个htaccess规则

/tel/index.php?id=4 转换成下面这样

/4__tel/index.php

------解决方案--------------------
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^.*/([0-9]+)__tel/index.php /tel/index.php?id=$1 [QSA,L]
------解决方案--------------------
([0-9]+) ,[]表示一个范围 0-9的任意一个数字!
------解决方案--------------------
apache 配置文件中的 rewrite_module 开了吗?
------解决方案--------------------

PHP code
方法1.    
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
RewriteRule ^(.*)/([0-9]+)__tel/index.php $1/tel/index.php?id=$2 [QSA,L]

方法2.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteBase /tel/
RewriteRule ([0-9]+)__tel/index.php index.php?id=$1 [QSA,L] <div class="clear">
                 
              
              
        
            </div>
登入後複製
相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!