【发布时间】:2013-04-01 12:31:10
【问题描述】:
我该如何做这样的事情: website.com/store/ 重定向到 website.com/store website.com/outbound/store/5 重定向到 website.com/outbound/store/5/
我想要的是没有前缀的 url 可以删除斜杠,而有前缀的 url 可以添加斜杠
我的 .htaccess:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)/$ /$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^pa/?$ /admin/index.php [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ stores.php?store=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^outbound/([^/]*)/([^/]*)$ /outbound.php?type=$1&id=$2 [L]
【问题讨论】:
-
前缀是什么意思?
-
前缀是指一些常量,比如最后一行“出站”
标签: apache .htaccess mod-rewrite trailing-slash