Apache重写规则
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Apache重写规则相关的知识,希望对你有一定的参考价值。
<IfModule rewrite_module> Options +FollowSymLinks RewriteEngine ON RewriteLog /Developer/Servers/apache2/logs/mod_rewrite.log RewriteLogLevel 2 # BlogCFC URL Rewrite Rules #RewriteRule ^/([A-Za-z0-9-]+)/projects/blog/([w]+)/index.cfm/(.*)$ /$1/projects/blog/$2/index.cfm?blogParams=$3 [PT,L] # Blog URL Rewrite Rules RewriteRule ^/([A-Za-z0-9-]+)/projects/blog/([w]+)/index.cfm/(.*)$ /$1/projects/blog/$2/index.cfm?blog_param=$3 [R] RewriteCond %{QUERY_STRING} ^blog_alias=([w]+)(.*)$ [NC] RewriteRule ^/([A-Za-z0-9-]+)/projects/(blog[0-9]*)/index.cfm /$1/projects/$2/%1/?%2 [R] # If trailing slash is not provided...add trailing slash, and go to default site RewriteRule ^/([A-Za-z0-9-]+)/projects/(blog[0-9]*)$ /$1/projects/$2/default/ [R] # If site is not provided...go to default site RewriteRule ^/([A-Za-z0-9-]+)/projects/(blog[0-9]*)/$ /$1/projects/$2/default/ [R] # If site is provided, but trailing slash is not provided...add trailing slash, and go to site RewriteRule ^/([A-Za-z0-9-]+)/projects/(blog[0-9]*)/([w]+)$ /$1/projects/$2/$3/ [R] # If loading an include...pass on through RewriteRule ^/([A-Za-z0-9-]+)/projects/(blog[0-9]*)/([w]+)/includes/(.*)$ /$1/projects/$2/includes/$4 [QSA,PT,L] RewriteRule ^/([A-Za-z0-9-]+)/projects/(blog[0-9]*)/([w]+)/admin/(.*)$ /$1/projects/$2/admin/$4?blog_alias=$3 [QSA,PT,L] # site is provided, and all is good...pass on through #RewriteRule ^/([A-Za-z0-9-]+)/(blog[0-9]*)/([w]+)/(.*)$ /$1/$2/index.cfm?blog_alias=$3 [QSA,PT,L] RewriteRule ^/([A-Za-z0-9-]+)/projects/(blog[0-9]*)/([w]+)/(.*)$ /$1/projects/$2/$4?blog_alias=$3 [QSA,PT,L] # CMS URL Rewrite Rules RewriteCond %{QUERY_STRING} ^site_alias=([w]+)(.*)$ [NC] RewriteRule ^/([A-Za-z0-9-]+)/projects/(cms[0-9]*)/index.cfm /$1/projects/$2/%1/?%2 [R] # If trailing slash is not provided...add trailing slash, and go to default site RewriteRule ^/([A-Za-z0-9-]+)/projects/(cms[0-9]*)$ /$1/projects/$2/default/ [R] # If site is not provided...go to default site RewriteRule ^/([A-Za-z0-9-]+)/projects/(cms[0-9]*)/$ /$1/projects/$2/default/ [R] # If site is provided, but trailing slash is not provided...add trailing slash, and go to site RewriteRule ^/([A-Za-z0-9-]+)/projects/(cms[0-9]*)/([w]+)$ /$1/projects/$2/$3/ [R] # If loading an asset...pass on through RewriteRule ^/([A-Za-z0-9-]+)/projects/(cms[0-9]*)/([w]+)/assets/(.*)$ /$1/projects/$2/assets/$4 [QSA,PT,L] # site is provided, and all is good...pass on through RewriteRule ^/([A-Za-z0-9-]+)/projects/(cms[0-9]*)/([w]+)/(.*)$ /$1/projects/$2/index.cfm?site_alias=$3 [QSA,PT,L] </IfModule>
以上是关于Apache重写规则的主要内容,如果未能解决你的问题,请参考以下文章