.htaccess url重寫舉例

.htaccess 開啓url重寫
php

<IfModule mod_rewrite.c>html

RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-d微信

RewriteCond %{REQUEST_FILENAME} !-furl

RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]spa

</IfModule>htm

 

url規則重寫舉例:ci

RewriteEngine On
#微信消息頁
RewriteRule ^WeChat_([0-9]+)_([0-9]+).php(.*) http://z.studyems.com/WeChat/main.php/wechat/messages/kcid/$1/type/$2/

#首頁
RewriteRule  ^index.php$                                    http://www.studyems.com/kaoshi/ [L]
RewriteRule  ^\/?$                                                http://www.studyems.com/kaoshi/ [L]

#搜索頁
RewriteRule ^searchindex\/?$                                 http://www.studyems.com/kaoshi/searchindex\.php [L]

RewriteRule ^search_questions\/?$                             http://www.studyems.com/kaoshi/search_questions\.php [L]

#內頁搜索頁
RewriteRule ^search\/?$                                     http://www.studyems.com/kaoshi/search\.php [L,QSA]

#文章內頁

#kaoshi-content***.html
RewriteRule ^kaoshi-content([0-9]+).html\/?$                 http://www.studyems.com/kaoshi/a$1.html [L]
RewriteRule ^kaoshi-content([0-9]+).html\/?([0-9]+)\/?$     http://www.studyems.com/kaoshi/a$1.html/$2/ [L]
it

相關文章
相關標籤/搜索