简体   繁体   English

添加斜杠并删除.htaccess

[英]add trailing slash and remove .htaccess

How can I do something like this that: website.com/store/ redirect to website.com/store website.com/outbound/store/5 redirect to website.com/outbound/store/5/ 如何执行以下操作:website.com/store/重定向到website.com/store website.com/outbound/store/5重定向到website.com/outbound/store/5/

what I want is to have for urls without prefix to remove trailing slash and for those with prefix to add trailing slash 我想要的是不带前缀的URL删除尾部斜杠,而带前缀的URL添加尾部斜杠

my .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]
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]

I also cleaned it up a bit. 我也清理了一下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM