2013-04-01 213 views
0

我該如何做這樣的事情: website.com/store/重定向到website.com/store website.com/outbound/store/5重定向到website.com/outbound /存儲/ 5/添加尾部斜槓並刪除.htaccess

我想要的是有沒有網址前綴去掉斜線和那些前綴加斜槓

我的.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] 
+0

你是什麼意思與前綴? – Gerben

+0

前綴我的意思是像最後一行'出站' – Marek

回答

1
Options +FollowSymLinks 
RewriteEngine on 
RewriteBase/

# force tailing slash for all urls starting with /outbound/ 
RewriteRule ^outbound/.*[^/]$ /$0/ [R=301,L] 

#remove tailing slash for all except urls starting with /outbound/ 
RewriteCond $1 !^outbound/ 
RewriteRule ^(.+)/$ /$1 [R=301,L] 

RewriteRule ^pa/?$ /admin/index.php [L,QSA] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^outbound/([^/]*)/([^/]*)/$ /outbound.php?type=$1&id=$2 [L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^([^/]+)$ stores.php?store=$1 [L] 

我也清理了一下。

相關問題